Jump to content
Sign in to follow this  
EmptySpace

Need help with checkboxes

Recommended Posts

EmptySpace

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.

Share this post


Link to post
Share on other sites
Skitty

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.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
EmptySpace

And what about button?

Share this post


Link to post
Share on other sites
Skitty

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

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
EmptySpace

Thanks maybe I will make from it what i want. Nice sounds btw ;)

Share this post


Link to post
Share on other sites
EmptySpace

But first part dont works correctly i still can check both boxes

Share this post


Link to post
Share on other sites
Skitty

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)
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?


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
EmptySpace

I never used these GUI things... But now i cant uncheck all boxes if i try then it checks other box ;)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×