Jump to content

Multiple Select For Radios Within The Same Group ?


Recommended Posts

How can I allow multiple select for radios within the same group (e.g. Selecting "short" and "long" at the same time) ?

thanks

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

How can I allow multiple select for radios within the same group (e.g. Selecting "short" and "long" at the same time) ?

thanks

By definition, Radios only allow a single selection in a group. You either need to use checkboxes (which allow multiple selections) instead or you need to define multiple radio groups.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Or if I can use checkboxes instead, but with the same style.

I already searched the help but the radio style for checkboxes, makes me unable to do multiple select.

Thanks DaleHohm.

I only need the radio style.

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

example

#include <GUIconstants.au3>

Opt("GUICoordMode", 1)

GUICreate("Radio Box Grouping Demo", 400,280)

; Create the controls
$button_1 = GUICtrlCreateButton ("B&utton 1", 30, 20, 120, 40)
$group_1 = GUICtrlCreateGroup ("Group 1", 30, 90, 165, 160)
GUIStartGroup()
$radio_1 = GUICtrlCreateRadio ("Radio &0", 50, 120, 70, 20)
GUIStartGroup()
$radio_2 = GUICtrlCreateRadio ("Radio &1", 50, 150, 60, 20)
GUIStartGroup()
$radio_3 = GUICtrlCreateRadio ("Radio &2", 50, 180, 60, 20)
GUIStartGroup()
$radio_4 = GUICtrlCreateRadio ("Radio &A", 120, 120, 70, 20)
GUIStartGroup()
$radio_5 = GUICtrlCreateRadio ("Radio &B", 120, 150, 60, 20)
GUIStartGroup()
$radio_6 = GUICtrlCreateRadio ("Radio &C", 120, 180, 60, 20)
GUIStartGroup()
$input_1 = GUICtrlCreateInput ("Input 1", 200, 20, 160, 30)
$input_2 = GUICtrlCreateInput ("Input 2", 200, 70, 160, 30)

; Set the defaults (radio buttons clicked, default button, etc)
GUICtrlSetState($radio_1, $GUI_CHECKED)
GUICtrlSetState($radio_6, $GUI_CHECKED)
GUICtrlSetState($button_1, $GUI_FOCUS + $GUI_DEFBUTTON)

; Init our vars that we will use to keep track of radio events
$radioval1 = 0   ; We will assume 0 = first radio button selected, 2 = last button
$radioval2 = 2

GUISetState ()

; In this message loop we use variables to keep track of changes to the radios, another
; way would be to use GUICtrlRead() at the end to read in the state of each control.  Both
; methods are equally valid
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         Exit
         
      Case $msg = $button_1
         MsgBox(0, "Button", "Radio " & $radioval1 & @LF & "Radio " & Chr($radioval2 + Asc("A")) & @LF & GUICtrlRead($input_1) & @LF & GUICtrlRead($input_2))
         
      Case $msg = $radio_1 OR $msg = $radio_2 OR $msg = $radio_3
         $radioval1 = $msg - $radio_1
         
      Case $msg = $radio_4 OR $msg = $radio_5 OR $msg = $radio_6
         $radioval2 = $msg - $radio_4

   EndSelect
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

Thank you all,

I thought there was a simpler way (like style) to enable mutilple select.

I guess I'll go with GUIStartGroup()

Thanks again.

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

I guess I'll go with GUIStartGroup()

Ok I used GUIStartGroup() but Im having a wearied issues with marking the radio as checked.

e.g. I can uncheck but I cannot check however tabbing works and if you select one and then click on your desktop then you click back on your window again it works!!

Please help me, I've been working on my script for over three month, I'm almost done I just need to finish this one.

Thanks,

Cool forum.

Edit: OS:XPSP2

Autoit Beta V3.1.1.117

Edit: Script was removed

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

I hope some one will give me an answer; otherwise I will have to use checkboxes (not pretty). :think:

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

why would you want to read the checked radio.. then uncheck it???

just comment out 1 line and ... presto

Func Radio_disable_enable()
    Local $L_GUI_READ_CTRLID = @GUI_CTRLID
    If guictrlread( $L_GUI_READ_CTRLID ) = $GUI_CHECKED Then
    ;GUICtrlSetState( $L_GUI_READ_CTRLID  , $GUI_UNCHECKED )
    Else
        GUICtrlSetState( $L_GUI_READ_CTRLID  , $GUI_CHECKED )
    EndIf
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

I hope some one will give me an answer; otherwise I will have to use checkboxes (not pretty). :think:

Why would checkboxes look worse. Surely an intuitive design would suggest that if something allows multiple selection it must use checkboxes (or a listbox).

I would never expect to see a user interface where a radio group allows multiple selection. The whole difference between radio buttons and checkboxes is precisely that checkboxes allow multiple selection wheras only one radio button per group can be selected.

Aside from being square rather than rounded, what's so different about checkboxes that would make your interface look bad by using them?

Link to comment
Share on other sites

Why would checkboxes look worse. Surely an intuitive design would suggest that if something allows multiple selection it must use checkboxes (or a listbox).

I would never expect to see a user interface where a radio group allows multiple selection. The whole difference between radio buttons and checkboxes is precisely that checkboxes allow multiple selection wheras only one radio button per group can be selected.

Aside from being square rather than rounded, what's so different about checkboxes that would make your interface look bad by using them?

actually, after looking at your script , i agree with eviloverlord

8)

NEWHeader1.png

Link to comment
Share on other sites

Valuater:

I must allow the user to uncheck after checking (incase he or she wanted to)

eviloverlord:

You are right, but too many checkboxes in a small GUI ...... it looks horrible :think:

If anyone is wondering what the hell this is for:

This part of my script is responsible for generating all the possible configurations for VPN sleeves.

Using Autoit and CMD shell, each configuration will be tested using FTP.

Thanks,

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

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...