fury0n Posted April 13, 2014 Share Posted April 13, 2014 How would I make a GUI with just two checkboxes, where they start different while loops? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 13, 2014 Moderators Share Posted April 13, 2014 fury0n,I am afraid your request makes little sense - normally you would have the one While...WEnd loop and do different things within it depending on which checkbox was checked. Can you explain in a little more detail what you are trying to do. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
fury0n Posted April 13, 2014 Author Share Posted April 13, 2014 (edited) fury0n, I am afraid your request makes little sense - normally you would have the one While...WEnd loop and do different things within it depending on which checkbox was checked. Can you explain in a little more detail what you are trying to do. M23 Haha I'm making such a fool of myself, I wish I had any clue what I was rambling about, no wonder why I make no sense. I hadn't gotten my cup of coffe just yet, I'll try to explain in more detail. #include <Constants.au3> #include <GUIConstantsEx.au3> Local $GUI = GUICreate("GUI", 180, 80) Local $radiobutton1 = GUICtrlCreateRadio("Option 1", 10, 10, 60) Local $radiobutton2 = GUICtrlCreateRadio("Option 2", 110, 10, 60) Local $button = GUICtrlCreateButton("OK", 10, 40, 160) GUISetState(@SW_SHOW, $GUI) While 1 Local $Msg = 0 $Msg = GUIGetMsg() Switch $Msg Case $radiobutton1 MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 1.") Case $radiobutton2 MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 2.") Case $button MsgBox($MB_SYSTEMMODAL, "Title", "I want the chosen option to run now.") Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd This is what I have right now. The issue here is that I don't want it to say "You have chosen option 1/2" until I've actually pressed the button. I'm still really new when it comes to AutoIt and I don't really know where to go from here, if you want me to explain it further I'll do my absolute best to do so. Edited April 13, 2014 by fury0n Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 13, 2014 Moderators Share Posted April 13, 2014 fury0n,How about this: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $GUI = GUICreate("GUI", 180, 80) Local $radiobutton1 = GUICtrlCreateRadio("Option 1", 10, 10, 60) Local $radiobutton2 = GUICtrlCreateRadio("Option 2", 110, 10, 60) Local $button = GUICtrlCreateButton("OK", 10, 40, 160) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $button If GUICtrlRead($radiobutton1) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 1.") Else MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 2.") EndIf MsgBox($MB_SYSTEMMODAL, "Title", "I want the chosen option to run now.") Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEndPlease ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
fury0n Posted April 13, 2014 Author Share Posted April 13, 2014 fury0n, How about this: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $GUI = GUICreate("GUI", 180, 80) Local $radiobutton1 = GUICtrlCreateRadio("Option 1", 10, 10, 60) Local $radiobutton2 = GUICtrlCreateRadio("Option 2", 110, 10, 60) Local $button = GUICtrlCreateButton("OK", 10, 40, 160) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $button If GUICtrlRead($radiobutton1) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 1.") Else MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 2.") EndIf MsgBox($MB_SYSTEMMODAL, "Title", "I want the chosen option to run now.") Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Please ask if you have any questions. M23 This has actually helped me a lot, thank you! How would I move on with three options instead? I added a little more. How would I do to make the MsgBox when I press OK to output whatever I input in the input boxes? #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $GUI = GUICreate("GUI", 360, 160) Local $radiobutton1 = GUICtrlCreateRadio("Option 1", 10, 10, 60) Local $radiobutton2 = GUICtrlCreateRadio("Option 2", 110, 10, 60) Local $button = GUICtrlCreateButton("OK", 10, 120, 160) Local $input1 = GUICtrlCreateInput("", 10, 40, 160) Local $input2 = GUICtrlCreateInput("", 10, 80, 160) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $button If GUICtrlRead($radiobutton1) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 1.") Else MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 2.") EndIf MsgBox($MB_SYSTEMMODAL, "Title", "You have written " & $input1 & " and " & $input2) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 13, 2014 Moderators Share Posted April 13, 2014 fury0n, How would I move on with three options instead?If GUICtrlRead($radiobutton1) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 1.") ElseIf GUICtrlRead($radiobutton2) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 2.") Else MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 3.") EndIfIf you have more than 3 I would start thinking about arrays. How would I do to make the MsgBox when I press OK to output whatever I input in the input boxes?Look at GUICtrlRead in the Help file. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
fury0n Posted April 13, 2014 Author Share Posted April 13, 2014 fury0n, If GUICtrlRead($radiobutton1) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 1.") ElseIf GUICtrlRead($radiobutton2) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 2.") Else MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 3.") EndIf If you have more than 3 I would start thinking about arrays. Look at GUICtrlRead in the Help file. M23 Until now I'll use ElseIf, gotta move on slowly, haha. I have really tried everything! It's so hard to learn programming from scratch when I don't know which functions there are, argh! Local $input1 = GUICtrlCreateInput("", 10, 40, 160) Local $input2 = GUICtrlCreateInput("", 10, 80, 160) $input1text = GUICtrlRead($input1) $input2text = GUICtrlRead($input2) MsgBox($MB_SYSTEMMODAL, "Title", "You have written " & $input1text & " and " & $input2text) I tried doing this but no luck. But I noticed that when I put any text in between the commas, like this: Local $input2 = GUICtrlCreateInput("asd", 10, 80, 160) It would output the asd, no matter what I typed in the input box after. I'm stuck again... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 15, 2014 Moderators Share Posted April 15, 2014 fury0n,If you read the inputs immediately after creation they will not give you their current content. You need to read them when you press the button - like this: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $GUI = GUICreate("GUI", 360, 160) Local $radiobutton1 = GUICtrlCreateRadio("Option 1", 10, 10, 60) Local $radiobutton2 = GUICtrlCreateRadio("Option 2", 110, 10, 60) GUICtrlSetState($radiobutton1, $GUI_CHECKED) ; Set a default selection <<<<<<<<<<<<<<<<<<<<<<<<<<< Local $button = GUICtrlCreateButton("OK", 10, 120, 160) Local $input1 = GUICtrlCreateInput("abc", 10, 40, 160) Local $input2 = GUICtrlCreateInput("def", 10, 80, 160) ; Do not read the inputs here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $button If GUICtrlRead($radiobutton1) = 1 Then MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 1.") Else MsgBox($MB_SYSTEMMODAL, "GUI Event", "You have chosen option 2.") EndIf ; Read the inputs now <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input1text = GUICtrlRead($input1) $input2text = GUICtrlRead($input2) MsgBox($MB_SYSTEMMODAL, "Title", "You have written " & $input1text & " and " & $input2text) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEndAll clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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