Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: dialog pushbutton button push return
ButtonPushed=Dialog("MyDialog")
Here is an example of how to use Pushbuttons:
; Define the dialog format EditFormat=`WWWDLGED,5.0` EditCaption=`Edit INI File` EditX=80 EditY=40 EditWidth=150 EditHeight=170 EditNumControls=14 Edit01=`5,3,40,DEFAULT,STATICTEXT,DEFAULT,"&Directory:"` Edit02=`42,3,100,DEFAULT,VARYTEXT,editfile,""` Edit03=`5,15,80,DEFAULT,EDITBOX,editfile,""` Edit04=`5,30,40,DEFAULT,STATICTEXT,DEFAULT,"&File:"` Edit05=`5,43,80,125,FILELISTBOX,editfile,DEFAULT` Edit06=`98,17,44,DEFAULT,CHECKBOX,backup,"Make &BAK",1` Edit07=`98,40,40,DEFAULT,RADIOBUTTON,state,"No&rmal",1` Edit08=`98,52,40,DEFAULT,RADIOBUTTON,state,"&Zoomed",2` Edit09=`98,64,40,DEFAULT,RADIOBUTTON,state,"&Iconized",3` Edit10=`95,82,44,DEFAULT,PUSHBUTTON,DEFAULT,"&Notepad",1` Edit11=`95,98,44,DEFAULT,PUSHBUTTON,DEFAULT,"&Studio",2` Edit12=`95,114,44,DEFAULT,PUSHBUTTON,DEFAULT,"Wri&te",3` Edit13=`95,130,44,DEFAULT,PUSHBUTTON,DEFAULT,"WinW&ord",4` Edit14=`91,151,52,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0` editfile = "*.INI" ; Set default mask for filelistbox backup = 1 ; Set the checkbox to be on by default state = 2 ; Set the 2nd radio button as the default ; Display the dialog, and wait for the user to press one of the ; pushbuttons. The variable "retval" will be equal to the value of ; whichever pushbutton is pressed. while @TRUE retval = Dialog("Edit") ; If the user didn't select a valid file, re-display the dialog If FileExist(editfile) Then break endwhile ; Find out if the checkbox was checked, and proceed accordingly If backup == 1 bakfile = StrCat(FileRoot(editfile), ".BAK") FileCopy(editfile, bakfile, @TRUE) endif ; Find out which radio button was pressed, and set the variable ; "runcmd" to the name of the appropriate member of the Run "family" Switch state case 1 runcmd = "Run" break case 2 runcmd = "RunZoom" break case 3 runcmd = "RunIcon" break endswitch ; Set the variable "editor", based on the pushbutton that was pressed Switch retval case 1 editor = "notepad.exe" break case 2 editor = "WinBatch Studio.exe" break case 3 editor = "write.exe" break case 4 editor = "winword.exe" break endswitch ; Execute the appropriate command (using variable substitution) %runcmd%(editor, editfile) Exit :cancel ; If we got here, it means the user pressed the Cancel pushbutton Message(EditCaption, "Operation cancelled")For RadioButtons in a group (only one of which may be selected at a time) use the SAME variable name for each radiobutton in the group, as in the example above:
Edit07=`98,40,40,DEFAULT,RADIOBUTTON,state,"No&rmal",1` Edit08=`98,52,40,DEFAULT,RADIOBUTTON,state,"&Zoomed",2` Edit09=`98,64,40,DEFAULT,RADIOBUTTON,state,"&Iconized",3`
Article ID: W12862
Filename: Which PushButton was Pushed.txt
File Created: 2001:01:08:12:08:28
Last Updated: 2001:01:08:12:08:28