satanttin Posted April 17, 2013 Share Posted April 17, 2013 Hello, I have a question about something if that's possible or not. the thing is i have a gui with a menu and i want that if i press a menuitem some stuff will show on the gui. but also want if i press another menuitem that other stuff will apear and the first data will be hide. is this possible? and ifso how can i do this with onevent code? Thanks in advance:) Link to comment Share on other sites More sharing options...
kylomas Posted April 17, 2013 Share Posted April 17, 2013 satanttin, i have a gui with a menuPost what you have...kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
satanttin Posted April 17, 2013 Author Share Posted April 17, 2013 what i tried so far is: func test() $Button1 = GUICtrlCreateButton("Button1", 288, 248, 193, 57) endfunc but when i press the menuitem it won't put the button in the gui so that's not possible i guess:') or i am doingsomething wrong Link to comment Share on other sites More sharing options...
satanttin Posted April 17, 2013 Author Share Posted April 17, 2013 this is what i got so far just part i tried doesn't work:( expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> Global $Form1 Opt("GUIOnEventMode", 1) main() Func main() $Form1 = GUICreate("Home", 1063, 749, 341, 199) $MenuItem4 = GUICtrlCreateMenu("Menu") $MenuItem8 = GUICtrlCreateMenuItem("Save", $MenuItem4) GUICtrlSetOnEvent($MenuItem8, "Save") $MenuItem7 = GUICtrlCreateMenuItem("Load", $MenuItem4) GUICtrlSetOnEvent($MenuItem7, "Load") $MenuItem6 = GUICtrlCreateMenuItem("empy", $MenuItem4) GUICtrlSetOnEvent($MenuItem6, "empty") $MenuItem5 = GUICtrlCreateMenuItem("Close", $MenuItem4) GUICtrlSetOnEvent($MenuItem5, "Close") $MenuItem3 = GUICtrlCreateMenu("test") GUICtrlSetOnEvent($MenuItem3, "test") $MenuItem2 = GUICtrlCreateMenu("empty") GUICtrlSetOnEvent($MenuItem2, "empty") $MenuItem1 = GUICtrlCreateMenu("empty") GUICtrlSetOnEvent($MenuItem1, "empty") $MenuItem10 = GUICtrlCreateMenuItem("Help", $MenuItem1) GUICtrlSetOnEvent($MenuItem10, "Help") $MenuItem9 = GUICtrlCreateMenuItem("Credits", $MenuItem1) GUICtrlSetOnEvent($MenuItem9, "Credits") GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "Close") EndFunc Func test() $Button1 = GUICtrlCreateButton("Button1", 288, 248, 193, 57) EndFunc While 1 sleep(10) WEnd Func Close() Exit EndFunc Link to comment Share on other sites More sharing options...
FireFox Posted April 17, 2013 Share Posted April 17, 2013 Hi, Try this : expandcollapse popup#include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $hForm1 = 0, $iButton1 = 0, $iButton2 = 0 Main() Func Main() Local $iMenuItem4 = 0, $iMenuItem7 = 0, $iMenuItem8 = 0 $hForm1 = GUICreate("MyGUI") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $MenuItem4 = GUICtrlCreateMenu("Menu") $MenuItem8 = GUICtrlCreateMenuItem("Save", $MenuItem4) GUICtrlSetOnEvent($MenuItem8, "_Save") $MenuItem7 = GUICtrlCreateMenuItem("Load", $MenuItem4) GUICtrlSetOnEvent($MenuItem7, "_Load") GUISetState(@SW_SHOW, $hForm1) EndFunc ;==>main Func _Save() If $iButton1 > 0 Then If $iButton2 > 0 Then GUICtrlSetState($iButton2, $GUI_HIDE) GUICtrlSetState($iButton1, $GUI_SHOW) EndIf $iButton1 = GUICtrlCreateButton("Button1", 20, 20, 200, 57) EndFunc ;==>test Func _Load() If $iButton2 > 0 Then If $iButton1 > 0 Then GUICtrlSetState($iButton1, $GUI_HIDE) GUICtrlSetState($iButton2, $GUI_SHOW) EndIf $iButton1 = GUICtrlCreateButton("Button2", 20, 200, 200, 57) EndFunc While 1 Sleep(1000) WEnd Func Close() GUIDelete($hForm1) Exit EndFunc ;==>Close Br, FireFox. Link to comment Share on other sites More sharing options...
satanttin Posted April 17, 2013 Author Share Posted April 17, 2013 Hi, Try this : expandcollapse popup#include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $hForm1 = 0, $iButton1 = 0, $iButton2 = 0 Main() Func Main() Local $iMenuItem4 = 0, $iMenuItem7 = 0, $iMenuItem8 = 0 $hForm1 = GUICreate("MyGUI") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $MenuItem4 = GUICtrlCreateMenu("Menu") $MenuItem8 = GUICtrlCreateMenuItem("Save", $MenuItem4) GUICtrlSetOnEvent($MenuItem8, "_Save") $MenuItem7 = GUICtrlCreateMenuItem("Load", $MenuItem4) GUICtrlSetOnEvent($MenuItem7, "_Load") GUISetState(@SW_SHOW, $hForm1) EndFunc ;==>main Func _Save() If $iButton1 > 0 Then If $iButton2 > 0 Then GUICtrlSetState($iButton2, $GUI_HIDE) GUICtrlSetState($iButton1, $GUI_SHOW) EndIf $iButton1 = GUICtrlCreateButton("Button1", 20, 20, 200, 57) EndFunc ;==>test Func _Load() If $iButton2 > 0 Then If $iButton1 > 0 Then GUICtrlSetState($iButton1, $GUI_HIDE) GUICtrlSetState($iButton2, $GUI_SHOW) EndIf $iButton1 = GUICtrlCreateButton("Button2", 20, 200, 200, 57) EndFunc While 1 Sleep(1000) WEnd Func Close() GUIDelete($hForm1) Exit EndFunc ;==>Close Br, FireFox. tried your code and it does shown the buttons just when i press another the other stuff will remain there:( i don't want that to happen:P and i don't really understand your coding:P but that's just a matter of minutes till i do so just one problem xD Link to comment Share on other sites More sharing options...
satanttin Posted April 17, 2013 Author Share Posted April 17, 2013 Meh i just use one gui as my menu and then use sub gui's to show my content:P like a floating menu thing ^^ would be cooler anywaysO.o i think Link to comment Share on other sites More sharing options...
FireFox Posted April 17, 2013 Share Posted April 17, 2013 and the question is ? Link to comment Share on other sites More sharing options...
satanttin Posted April 17, 2013 Author Share Posted April 17, 2013 and the question is ?huh what question?sorry i feel dumb right now:') Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now