Sign in to follow this  
Followers 0
Achilles

Checkbox problem

3 posts in this topic

#1 ·  Posted (edited)

Alright I've just started trying to use checkboxes so this 'problem' should be easy for those who use this more. I have a Guibox with four checkboxes and if they are all checked it's supposed to do all four things. But it doesn't work. It just does the first one and then stops. I'll post the part that isn't working because there's a bunch of other stuff in the program.

Func Startup()
GUICreate("Question", 226, 200, -1, -1)
GuiCTRLCreateLabel("What steps of startup do you want to do?", 10, 8, 200, 20)
$internet = GUICtrlCreateCheckbox("Gmail and Hotmail", 25, 30, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$bitlord = GUICtrlCreateCheckbox("Bitlord", 25, 60, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$msn = GUICtrlCreateCheckbox("MSN Messenger", 25, 90, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$itunes = GUICtrlCreateCheckbox("iTunes", 25, 120, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$ok = GUICtrlCreateButton( "Continue with startup", 100, 150, 120, 35)
$back = GUICtrlCreateButton( "Go Back", 13, 150, 60, 35)                

GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $back
        Guidelete()
                Exit
    Case $msg = $ok
     If BitAnd(GUICtrlRead($internet),$GUI_CHECKED) = $GUI_CHECKED then 
        GUIDelete()
        Mozilla()
        Endif
     If BitAnd(GUICtrlRead($bitlord), $GUI_CHECKED) = $GUI_CHECKED then
        GUIDelete()
        Bitlord()
        Endif
     If BitAnd(GUICtrlRead($msn), $GUI_CHECKED) = $GUI_CHECKED then
        GUIDelete()
        MSN()
        Endif
     If BitAnd(GUICtrlRead($itunes), $GUI_CHECKED) = $GUI_CHECKED then
        GUIDelete()
        Run("C:\Program Files\iTunes\iTunes.exe")
        Endif
    Exit
    EndSelect
WEnd
Endfunc

Anyhelp would be appreciated even if it's just a sample checkbox thing that works. The ones in the tutorials don't do anything they just appear which is easy.

Pianoman

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Alright I've just started trying to use checkboxes so this 'problem' should be easy for those who use this more. I have a Guibox with four checkboxes and if they are all checked it's supposed to do all four things. But it doesn't work. It just does the first one and then stops. I'll post the part that isn't working because there's a bunch of other stuff in the program.

Func Startup()
GUICreate("Question", 226, 200, -1, -1)
GuiCTRLCreateLabel("What steps of startup do you want to do?", 10, 8, 200, 20)
$internet = GUICtrlCreateCheckbox("Gmail and Hotmail", 25, 30, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$bitlord = GUICtrlCreateCheckbox("Bitlord", 25, 60, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$msn = GUICtrlCreateCheckbox("MSN Messenger", 25, 90, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$itunes = GUICtrlCreateCheckbox("iTunes", 25, 120, 120, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)
$ok = GUICtrlCreateButton( "Continue with startup", 100, 150, 120, 35)
$back = GUICtrlCreateButton( "Go Back", 13, 150, 60, 35)                

GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $back
        Guidelete()
                Exit
    Case $msg = $ok
     If BitAnd(GUICtrlRead($internet),$GUI_CHECKED) = $GUI_CHECKED then 
        GUIDelete()
        Mozilla()
        Endif
     If BitAnd(GUICtrlRead($bitlord), $GUI_CHECKED) = $GUI_CHECKED then
        GUIDelete()
        Bitlord()
        Endif
     If BitAnd(GUICtrlRead($msn), $GUI_CHECKED) = $GUI_CHECKED then
        GUIDelete()
        MSN()
        Endif
     If BitAnd(GUICtrlRead($itunes), $GUI_CHECKED) = $GUI_CHECKED then
        GUIDelete()
        Run("C:\Program Files\iTunes\iTunes.exe")
        Endif
    Exit
    EndSelect
WEnd
Endfunc

Anyhelp would be appreciated even if it's just a sample checkbox thing that works. The ones in the tutorials don't do anything they just appear which is easy.

Pianoman

That's happening because you do a GUIDelete() on the first one that's checked. Move a single GUIDelete() to the end of the OK case and get rid of the others.

:whistle:

P.S. Actually just delete all the GUIDelete() anyway. They are all redundant if you leave those Exit statements in there. AutoIT deletes all child GUIs when the scipt exits already.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

That's happening because you do a GUIDelete() on the first one that's checked. Move a single GUIDelete() to the end of the OK case and get rid of the others.

:whistle:

P.S. Actually just delete all the GUIDelete() anyway. They are all redundant if you leave those Exit statements in there. AutoIT deletes all child GUIs when the scipt exits already.

Ok thanks, that solved it. I think I put the GUIDelete()'s 'cause I didn't like the boxes in the background but I'll just do a Gui hide. And sorry for posting this in the main forum... I didn't notice the special part for GUI problems...

Piano_man


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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