EmptySpace Posted May 28, 2012 Share Posted May 28, 2012 So for example I have #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 173, 81, 192, 124) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 8, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 8, 32, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 8, 56, 97, 17) $Button1 = GUICtrlCreateButton("Button1", 88, 8, 75, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd How to make it when you mark one check box and hit button it do one function, switching other checkbox and hitting button it do another function? Its like tree view when you click directly on it and starts func but this one need to hit button if i need to start. I should read values or what? Also I dont want here to be able to check all boxes . for exmpl one box is checked when you hit on other chekbox then previos x dissapears. Link to comment Share on other sites More sharing options...
Skitty Posted May 28, 2012 Share Posted May 28, 2012 Opt("GUIOnEventMode", 1) GUICreate("test",100,50) GUISetOnEvent(-3,"_Exit") Global $Test = GUICtrlCreateCheckbox("test",10,10,50,17) GUICtrlSetOnEvent(-1,"testfunc") Global $Test2 = GUICtrlCreateCheckbox("test2",10,30,50,17) GUISetState() Sleep(9999999999) Func testfunc() Switch GUICtrlRead($Test) Case 1 Beep(100,100) GUICtrlSetState($Test2,4) Case 4 GUICtrlSetState($Test2,1) Beep(300,100) EndSwitch EndFunc Func _Exit() Exit EndFunc look for examples in the help file, there are lots. Link to comment Share on other sites More sharing options...
EmptySpace Posted May 28, 2012 Author Share Posted May 28, 2012 And what about button? Link to comment Share on other sites More sharing options...
Skitty Posted May 28, 2012 Share Posted May 28, 2012 And what about button? Ah, the new in this one is strong. Opt("GUIOnEventMode", 1) GUICreate("test", 150, 60) GUISetOnEvent(-3, "_Exit") Global $Test = GUICtrlCreateCheckbox("test", 10, 10, 50, 17) GUICtrlSetOnEvent(-1, "testfunc") Global $Test2 = GUICtrlCreateCheckbox("test2", 10, 30, 50, 17) Global $damnbutton = GUICtrlCreateButton("stupid button",60,8,70,50) GUICtrlSetOnEvent(-1, "redundentness") GUISetState() Sleep(9999999999) Func testfunc() Switch GUICtrlRead($Test) Case 1 Beep(100, 100) GUICtrlSetState($Test2, 4) Case 4 GUICtrlSetState($Test2, 1) Beep(300, 100) EndSwitch EndFunc ;==>testfunc Func redundentness() Select Case GUICtrlRead($Test) = 1 And GUICtrlRead($Test2) = 1 Beep(520,100) Case GUICtrlRead($Test) = 1 And GUICtrlRead($Test2) = 4 Beep(670,100) Case GUICtrlRead($Test) = 4 And GUICtrlRead($Test2) = 1 Beep(850,100) Case GUICtrlRead($Test) = 4 And GUICtrlRead($Test2) = 4 Beep(1000,100) EndSelect EndFunc Func _Exit() Exit EndFunc ;==>_Exit Link to comment Share on other sites More sharing options...
EmptySpace Posted May 28, 2012 Author Share Posted May 28, 2012 Thanks maybe I will make from it what i want. Nice sounds btw Link to comment Share on other sites More sharing options...
EmptySpace Posted May 28, 2012 Author Share Posted May 28, 2012 But first part dont works correctly i still can check both boxes Link to comment Share on other sites More sharing options...
Skitty Posted May 28, 2012 Share Posted May 28, 2012 expandcollapse popupOpt("GUIOnEventMode", 1) GUICreate("test", 150, 60) GUISetOnEvent(-3, "_Exit") Global $Test = GUICtrlCreateCheckbox("test", 10, 10, 50, 17) GUICtrlSetOnEvent(-1, "testfunc") Global $Test2 = GUICtrlCreateCheckbox("test2", 10, 30, 50, 17) GUICtrlSetOnEvent(-1, "testfunc2") Global $damnbutton = GUICtrlCreateButton("stupid button",60,8,70,50) GUICtrlSetOnEvent(-1, "redundentness") GUISetState() Sleep(9999999999) Func testfunc() Switch GUICtrlRead($Test) Case 1 Beep(100, 100) GUICtrlSetState($Test2, 4) Case 4 GUICtrlSetState($Test2, 1) Beep(300, 100) EndSwitch EndFunc ;==>testfunc Func testfunc2() Switch GUICtrlRead($Test2) Case 1 Beep(180, 100) GUICtrlSetState($Test, 4) Case 4 GUICtrlSetState($Test, 1) Beep(200, 100) EndSwitch EndFunc ;==>testfunc Func redundentness() Select Case GUICtrlRead($Test) = 1 And GUICtrlRead($Test2) = 1 Beep(520,100) Case GUICtrlRead($Test) = 1 And GUICtrlRead($Test2) = 4 Beep(670,100) Case GUICtrlRead($Test) = 4 And GUICtrlRead($Test2) = 1 Beep(850,100) Case GUICtrlRead($Test) = 4 And GUICtrlRead($Test2) = 4 Beep(1000,100) EndSelect EndFunc Func _Exit() Exit EndFunc ;==>_Exit you've been here since `2011, why don't you know this yet? Barley logging on? Link to comment Share on other sites More sharing options...
EmptySpace Posted May 28, 2012 Author Share Posted May 28, 2012 I never used these GUI things... But now i cant uncheck all boxes if i try then it checks other box 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