Jump to content

Why do these Radio Buttons act as a "group"?


cbruce
 Share

Recommended Posts

The example code shows my quandry.... The Radio Buttons act as a "group" (only one selected at a time, etc.),

even though there is no GUICtrlCreateGroup() or GUIStartGroup().

Why are they acting as if they were grouped??

When do I need to use GUICtrlCreateGroup() or GUIStartGroup()?

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIResizeMode", $GUI_DOCKAUTO)

#Region ### START Koda GUI section ### Form=
$Form1_ID = GUICreate("Win_Title", 1012, 200, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))
GUISetFont(10, 400, 0, "MS Sans Serif")
$btn_Now_ID = GUICtrlCreateButton("Now", 16, 24, 57, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$date_From_ID = GUICtrlCreateDate("2010/10/24 19:45:1", 152, 8, 185, 21)
GUICtrlSetFont(-1, 9, 400, 0, "Courier")
$date_To_ID = GUICtrlCreateDate("2010/10/24 19:45:1", 152, 40, 185, 21)
GUICtrlSetFont(-1, 9, 400, 0, "Courier")
$inp_SpanHHmm_ID = GUICtrlCreateInput("", 424, 8, 81, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
GUICtrlSetFont(-1, 12, 400, 0, "Courier")
$inp_SpanMinutes_ID = GUICtrlCreateInput("", 424, 40, 81, 24)
GUICtrlSetFont(-1, 12, 400, 0, "Courier")
$cbo_Channel_ID = GUICtrlCreateCombo("", 642, 8, 207, 25)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 12, 400, 0, "Courier")
$btn_Clear_TVShow_Filename_ID = GUICtrlCreateButton("Clear", 17, 80, 57, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$txt_TVShow_Filename_ID = GUICtrlCreateEdit("", 152, 72, 841, 48)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 10, 400, 0, "Courier")

$lbl_Start_ID = GUICtrlCreateLabel("Start", 94, 8, 39, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Stop_ID = GUICtrlCreateLabel("Stop", 94, 40, 38, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_HHmm_ID = GUICtrlCreateLabel("HH:mm", 352, 8, 63, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Minutes_ID = GUICtrlCreateLabel("Minutes", 351, 40, 63, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Channel_ID = GUICtrlCreateLabel("Channel", 560, 8, 71, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_File_xxx_ID = GUICtrlCreateLabel("File -", 94, 72, 55, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_xxx_Name_ID = GUICtrlCreateLabel("Name", 94, 90, 55, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lbl_Device = GUICtrlCreateLabel("Device", 560, 40, 71, 23)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

; ????????????????????
; These Radio Buttons act as a "group" (only one selected at a time, etc.),
; even though there is no GUICtrlCreateGroup() or GUIStartGroup()...
; ????????????????????
;GUIStartGroup()
$rad_PVR = GUICtrlCreateRadio("PVR", 640, 40, 49, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$rad_VCR = GUICtrlCreateRadio("VCR", 704, 40, 49, 17)
$rad_DVR = GUICtrlCreateRadio("DVR", 768, 40, 49, 17)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Form1_ID
        Case $btn_Now_ID
        Case $date_From_ID
        Case $date_To_ID
        Case $inp_SpanHHmm_ID
        Case $inp_SpanMinutes_ID
        Case $cbo_Channel_ID
        Case $btn_Clear_TVShow_Filename_ID
        Case $txt_TVShow_Filename_ID

        Case $rad_PVR
            MsgBox( 0, "Event", "$rad_PVR", 1)
        Case $rad_VCR
            MsgBox( 0, "Event", "$rad_VCR", 1)
        Case $rad_DVR
            MsgBox( 0, "Event", "$rad_DVR", 1)
    EndSwitch
WEnd

Thanks,

CBruce

Link to comment
Share on other sites

Radio buttons will always act as if in a group even when there's no grouping, because it's implied by default that they're grouped. You would use GUIStartGroup() when you have multiple radio buttons but you don't want them all linked together. For instance, you have 3 sets of radio buttons Group1, Group2, Group3; you want to start a group (GUIStartGroup())before creating each group so that the buttons in each group only affect the buttons within that group and not the other 2 groups.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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