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

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

Variable Number of Controls in a Dialog

Keywords:   Variable Number Controls Dialog Dynamically Create

Question:

Can you have a WB script read from a list of names and show a box with a list of names and a check mark box next to each name.

Answer:

Maybe take a look at the Wil Dialog Editor. Also get really familiar with the Dialog function. You could create a script that dynamically creates a dialog with the number of names from your list...

Here is one example:

namelist='Alan':@TAB:'Bob':@TAB:'Charlie':@TAB:'David':@TAB:'Edgar':@TAB:'Fred':@TAB:'George':@TAB:'Howard':@TAB:'Ian':@TAB:'Jeff' :@TAB:'Kevin':@TAB:'Lee':@TAB:'Morrie'

count = ItemCount(namelist,@TAB)

MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`Dynamic Name Lister`
MyDialogX=9999
MyDialogY=9999
MyDialogWidth=150
MyDialogHeight=116
MyDialogNumControls=(count)+3 ;Includes two pushbuttons


MyDialog001=`011,007,048,012,PUSHBUTTON,"PushButton_Ok",DEFAULT,"&OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`065,007,048,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"&Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`011,023,100,012,STATICTEXT,"StaticText_2",DEFAULT,"Name(s):",DEFAULT,50,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
controlcount = 3

;builds dialog controls for each item
For xx=1 To count

   item = ItemExtract(xx,namelist,@TAB)
   dlgup= xx + controlcount
   dlgup = StrFixLeft(dlgup,0,3)
   vert = (xx*11) + 25
   MyDialogHeight=MyDialogHeight+8
   MyDialog%dlgup%=`020,%vert%,050,012,CHECKBOX,"CheckBox_1",update%xx%,"%item%",1,80,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

Next

ButtonPushed=Dialog("MyDialog")
Exit

Article ID:   W15119
File Created: 2010:04:23:09:19:08
Last Updated: 2010:04:23:09:19:08