Sign in to follow this  
Followers 0
EmptySpace

Declare variables with checkboxes?

4 posts in this topic

#1 ·  Posted (edited)

Im lost... I want to use multiple checked boxes and get words.

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Show
msgbox(0,"",$word1)
msgbox(0,"",$word2)
and so on to see if it works..?
Case $Read
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If GUICtrlRead ($Checkbox1) = 1 Then
Dim $word1 ="text1"
If GUICtrlRead ($Checkbox2) = 1 Then
$word2 ="text2"
If GUICtrlRead ($Checkbox3) = 1 Then
$word3 ="text3"
If GUICtrlRead ($Checkbox4) = 1 Then
$word4 ="text4"
If GUICtrlRead ($Checkbox5) = 1 Then
$word5 ="text5"
If GUICtrlRead ($Checkbox6) = 1 Then
$word6 ="text6"
If GUICtrlRead ($Checkbox7) = 1 Then
$word7 ="text7"
If GUICtrlRead ($Checkbox8) = 1 Then
$word8 ="text8"
If GUICtrlRead ($Checkbox9) = 1 Then
$word9 ="text9"
Endif
Endif
Endif
Endif
Endif
Endif
Endif
Endif
Endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EndSwitch
WEnd

Maybe I badly used If's? Also I want if checkbox isnt checked then do nothing (dont return/declare variable).

If i want to get 1 variable from first checkbox then i get it but cant get other....

Edited by Edgaras

Share this post


Link to post
Share on other sites



Does it work with this modification? Using nested If's is a bad idea here, if (no pun intended) the first one is false, none of the others will be processed.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If GUICtrlRead ($Checkbox1) = 1 Then $word1 ="text1"
If GUICtrlRead ($Checkbox2) = 1 Then $word2 ="text2"
If GUICtrlRead ($Checkbox3) = 1 Then $word3 ="text3"
If GUICtrlRead ($Checkbox4) = 1 Then $word4 ="text4"
If GUICtrlRead ($Checkbox5) = 1 Then $word5 ="text5"
If GUICtrlRead ($Checkbox6) = 1 Then $word6 ="text6"
If GUICtrlRead ($Checkbox7) = 1 Then $word7 ="text7"
If GUICtrlRead ($Checkbox8) = 1 Then $word8 ="text8"
If GUICtrlRead ($Checkbox9) = 1 Then $word9 ="text9"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Wow, thanks it works. ;) Talking about If's I can use it without endif? For example If stringinstr() then...?

Or only with " = 1"," = 0" things?

Share this post


Link to post
Share on other sites

Wow, thanks it works. ;) Talking about If's I can use it without endif? For example If stringinstr() then...?

Or only with " = 1"," = 0" things?

They both end up as If False or If True, what you are comparing doesn't matter. If is If.

Singleline Ifs have no EndIf (they would be multiline then...), multiline have them. There are no more to it. See If in helpfile.

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  
Followers 0