VelvetElvis Posted August 12, 2011 Posted August 12, 2011 (edited) I need two sets of radio buttons. A set of 3 buttons, and beside it a set of 2 buttons The 3 buttons are one group, and the 2 buttons a second group. Here's the catch: The buttons need to have the same class and instance as the original app that I need to replicate, and be named consecutively. The original app buttons are [CLASS:Button; INSTANCE:1] through to [CLASS:Button; INSTANCE:5] Problem is, I had to put the buttons inside a Group box, because they need to operate as 2 groups. Unfortunately, these groups are considered a button when I use the Window Info tool, so my buttons are no longer named consecutively. If I remove the group boxes, my Classname and instances are consecutive, but the buttons work as one group. My question is: how do I get the radio buttons to work as two groups, yet keep the naming and instance consecutive? (Hope this makes sense) EDIT: Sorry.. found the answer. All that I needed to do was insert "GUIStartGroup() above the radio button group I want to create. Edited August 12, 2011 by VelvetElvis
Moderators Melba23 Posted August 12, 2011 Moderators Posted August 12, 2011 VelvetElvis,Use GUICreateGroup to get the Radio controls suitably grouped and then create the Group controls afterwards. Here is an example - the Radio controls are artificially elongated to get them to show outside the Group boxes so that the Window Info tool can see them easily:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) GUIStartGroup() $hRadio_1 = GUICtrlCreateRadio("Radio 1", 20, 30, 400, 20) $hRadio_2 = GUICtrlCreateRadio("Radio 2", 20, 50, 400, 20) $hRadio_3 = GUICtrlCreateRadio("Radio 3", 20, 70, 400, 20) GUIStartGroup() $hRadio_4 = GUICtrlCreateRadio("Radio 4", 20, 130, 400, 20) $hRadio_5 = GUICtrlCreateRadio("Radio 5", 20, 150, 400, 20) GUIStartGroup() $hGroup_1 = GUICtrlCreateGroup("Group 1", 10, 10, 120, 90) $hGroup_2 = GUICtrlCreateGroup("Group 2", 10, 110, 120, 70) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndWorks for me - good for you too? 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
VelvetElvis Posted August 12, 2011 Author Posted August 12, 2011 VelvetElvis, Use GUICreateGroup to get the Radio controls suitably grouped and then create the Group controls afterwards. Here is an example - the Radio controls are artificially elongated to get them to show outside the Group boxes so that the Window Info tool can see them easily: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) GUIStartGroup() $hRadio_1 = GUICtrlCreateRadio("Radio 1", 20, 30, 400, 20) $hRadio_2 = GUICtrlCreateRadio("Radio 2", 20, 50, 400, 20) $hRadio_3 = GUICtrlCreateRadio("Radio 3", 20, 70, 400, 20) GUIStartGroup() $hRadio_4 = GUICtrlCreateRadio("Radio 4", 20, 130, 400, 20) $hRadio_5 = GUICtrlCreateRadio("Radio 5", 20, 150, 400, 20) GUIStartGroup() $hGroup_1 = GUICtrlCreateGroup("Group 1", 10, 10, 120, 90) $hGroup_2 = GUICtrlCreateGroup("Group 2", 10, 110, 120, 70) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Works for me - good for you too? M23 Yes, that's great. Thank you M23. One question that I couldn't find the answer to, is what other controls does GUIStartGroup() apply to? The help says "This function is generally used when working with radio button controls. Does it apply to any other controls?
Moderators Melba23 Posted August 12, 2011 Moderators Posted August 12, 2011 VelvetElvis,Does it apply to any other controls?I have no idea! But off the top off my head I cannot think of any reason to have other controls in groups. I have noticed that Koda adds $WS_GROUP to all "button" controls, so there might well be one and I have just never needed it. 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
VelvetElvis Posted August 12, 2011 Author Posted August 12, 2011 VelvetElvis,I have no idea! But off the top off my head I cannot think of any reason to have other controls in groups. I have noticed that Koda adds $WS_GROUP to all "button" controls, so there might well be one and I have just never needed it. M23Only reason I ask is if I had this in between other controls, instead of right before the GUISetState(), as in your example, I wouldn't want another control to get inadvertently grouped with the radio buttons. This would happen when you're trying to keep the tab order on your form.As it turns out, on my code, it's not an issue with the controls following.Thanks again, M23!
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