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.

Automatical Numbering of Dialog Controls

Keywords:     autonumber dialog controls

Question:

Is there anyway to automatically manage control numbering i.e. negating the need to manually manage the 'xxxNumControls=nn' statement.

Answer:

When you use the Dialog Editor, it automatically numbers your controls.

One of our users provided the following. NB: This is untested code:

Many of my dialogues have conditional controls, as they are all quite variable to current conditions. I therefore have xNumControls=?? as the last line before the Dialog() statement

To do this you need to a variable to keep track of what control you are on, and I usually use that variable in the building of the dialogue statement.

eg: Radio button Example:

;================snip===================
; put all other controls first.
; assume that the last control is
; control 10, at y-value 100 (vertical)

xlist = tab-delimited list of unknown number of radiobutton choices to go into a dialog
y = 100
xctl = 10

For i = i to ItemCount(list, @tab)
xctl = xctl + 1; get next ctrl num
y = y + 12 ; adv down
xname = ItemExtract(i, list, @tab)
Dlg%xctl%=`10,%y%,50,DEFAULT,RADIOBUTTON,variable,,"%xname%",%i%`
Next
DlgNumControls = xctl
button = Dialog(Dlg)
You will probably have to use the number of items to determine the height of the dialog, or the width, or whatever. You also have to know that Controls under 10 are known as Dlg01 - Dlg09 (ie- the numbers are zero-padded) I usually find it easier to start variable control numbers at 10 or 11 to get over this and if I don't have 9 other controls, I have something like;
Dlg07=``
Dlg08=``
Dlg09=``
just so that it does not blow up.
Article ID:   W12827
Filename:   Automatically Number Dialog Controls.txt
File Created: 1999:04:15:16:49:54
Last Updated: 1999:04:15:16:49:54