WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor version 6.2
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Radiobutton Group With None Selected

 Keywords: Radiobutton Group Radio Buttons No Default Selection None Selected 

Question:

Is it possible to have a dialog that comes up with none of its radio buttons pre-selected as default?

Answer:

Each radio button of a group has a value associated with it and each radio button of a group has the same variable associated with it. The variable association is what makes the several radio buttons a group. If you set that radio button variable to a value other than zero that is not associated with any of the group's buttons before you call the Dialog function, no button will be 'dotted' when the dialog containing the radio group starts.
var1 = 9999
MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`WIL Dialog`
MyDialogX=048
MyDialogY=065
MyDialogWidth=304
MyDialogHeight=193
MyDialogNumControls=004
MyDialogProcedure=`MyDialogCallbackProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`025,019,050,012,RADIOBUTTON,"RadioButton_1",var1,"radio1",1,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`025,039,050,012,RADIOBUTTON,"RadioButton_2",var1,"radio2",2,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`025,057,050,012,RADIOBUTTON,"RadioButton_3",var1,"radio3",3,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`089,129,036,012,PUSHBUTTON,"PushButton_1",DEFAULT,"Ok",1,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")
Exit


OR I suppose you could create a dialog callback procedure that merely unsets the default Radiobutton in the initialization procedure.
#DefineFunction MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,MyDialog_ChangeInfo)
   ON_EQUAL = @TRUE                                         ; Initialize variable ON_EQUAL
   MSG_INIT = 0
   RET_DO_CANCEL=0           ; Cancels dialog
   RET_DO_DEFAULT= -1        ; Continue with default processing for control
   RET_DO_NOT_EXIT= -2       ; Do not exit the dialog
   Switch MyDialog_Message                                  ; Switch based on Dialog Message type
      Case MSG_INIT                                         ; Standard Initialization message
          DialogControlSet( MyDialog_Handle, 'RadioButton_1', 2, 0 )
         Return(RET_DO_DEFAULT)
   EndSwitch                                                ; MyDialog_Message
   Return(RET_DO_DEFAULT)
#EndFunction                                                ; End of Dialog Callback MyDialogCallbackProc


MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`WIL Dialog`
MyDialogX=048
MyDialogY=065
MyDialogWidth=304
MyDialogHeight=193
MyDialogNumControls=004
MyDialogProcedure=`MyDialogCallbackProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`025,019,050,012,RADIOBUTTON,"RadioButton_1",drive1,"radio1",1,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`025,039,050,012,RADIOBUTTON,"RadioButton_2",drive1,"radio2",2,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`025,057,050,012,RADIOBUTTON,"RadioButton_3",drive1,"radio3",3,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`089,129,036,012,PUSHBUTTON,"PushButton_1",DEFAULT,"Ok",1,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")

Article ID:   W18512
Filename:   Radiobutton Group With None Selected.txt
File Created: 2014:07:30:12:19:08
Last Updated: 2014:07:30:12:19:08