Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialog Box Selections

Status
Not open for further replies.

hankm3

Programmer
Jan 27, 2002
284
US
Hello,

I want to Create a Dialog Box with 3 or more Selection Options. 2 with Radio Buttons and 1 DIR List Box. Once the user has selected the 3 Options, the user can Press an "Execute" Button to Process the Transaction or Press a "Reset" Button to Make Updates before the Execute Begins. Question here is, Do I need to go thru all of that or when the User Presses the "Execute", the Buttons Currently Pressed will be processed ?? Also how do you "Link" the Buttons together, so at Least One of Each Selection is Pressed before"Execute" can begin ?

Sorta Stupid, but still "FRESH" in the Aspect Waters !!

Hank
 
Sorry not to answer this earlier, missed it somehow.

Been a while since I've done much with dialogs, but here's what I noticed. First, there will always be a default radiobutton (the first) in each radiobutton group that you have defined, unless you initialize the integer variable to a different selection. This basically means that your script will just need to make sure that an item is selected from the dirlistbox. Here is a script I whipped up that shows one idea to do this, it requires that the string variable that holds the selected file (SelectVar1) be set to null before the dialog is displayed:

proc main

integer Var1, Var2, Event
string FnameVar1, SelectVar1=""

dialogbox 0 8 21 291 188 2 "Caption"
radiogroup 9 Var1
radiobutton 1 32 17 42 11 "Choice 1"
radiobutton 2 31 46 42 11 "Choice 2"
endgroup
radiogroup 10 Var2
radiobutton 5 32 116 42 11 "Choice 3"
radiobutton 6 32 150 42 11 "Choice 4"
endgroup
dirlistbox 3 172 25 48 32 FnameVar1 SINGLE SelectVar1
pushbutton 4 172 100 40 13 "Execute"
groupbox 7 18 2 79 68 "Group 1"
groupbox 8 16 103 86 70 "Group 2"
enddialog

while 1
dlgevent 0 Event
switch Event
case 4 ;If Execute button selected...
if not nullstr SelectVar1
exitwhile
endif
endcase
default
endcase
endswitch
endwhile

usermsg "%s" SelectVar1

endproc

I didn't add any logic for the reset button you also need, but hopefully this solves the problem you were having.
 
Knob,

Took your Example and used it in my Script. It works well. Would like to figure out a way to Keep the First RadioButton set as the Default; but I will work on that Issue. What I plan on doing is setting the First RadioBtton as a View File. The Remaining selections will be used by the User. The part of your Code that keeps the Script from Executing until the Selection of a DirFileListing Helped. I'll work on the NO Default RadioButton Issue. I Tried -1 but that didn't work either. And I don't think you can set an Integer to "NULL". Anyway thanks for the Help.

Hank
 
I can't find this anywhere in the documentation, but it looks like if the initial value of the integer isn't valid (i.e. doesn't correspond to one of the radiobutton IDs), then the first radiobutton in the group will be selected by default. I suppose you could always add a bogus radiobutton with a caption that says something like "Make a selection below" and if that radiobutton is still selected when the Execute button is pressed, you would not drop out of the while loop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top