Jump to content

Declare variables with checkboxes?


Recommended Posts

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
Link to comment
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.

Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...