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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I set up this Dialog Bx? 1

Status
Not open for further replies.

Woodro

Technical User
Jul 31, 2002
78
US
How do I set up this Dialog Bx? In this example once a selection is made and the check boxes are marked and tested with the switch/case statements, you can't go back and put a check in a different box(lets say you change your mind on your selection after you've already made one). I want to be able to have many question answered in the Dlg Bx and then have all of those veriables assigned once I click the OK button. I also need to be able to test for a question that didn't get answered so that it doesn't move forward until a selection have been made.
Here is what I have so far:

;============================================================================================================================
;Veriable Definisions
;====================
integer new
integer chg
integer prt
integer out
integer ac1
integer ac2
integer sum
;integer npa
;integer nxx
;integer spn
;integer yesdeny
;integer nodeny
;integer logyes
;integer logno
integer reqint
integer tran
;string rli
;string range
;string req

proc main
strartover:
dialogbox 0 8 20 292 177 2 "Gathering information"
text 1 8 2 56 11 "Enter your Req:" left
checkbox 2 8 15 56 11 "New" new
checkbox 3 8 29 56 11 "Change" chg
checkbox 4 8 44 56 11 "Print" Prt
checkbox 5 8 56 56 11 "Out" Out
text 6 8 68 55 11 "What Tran Type:" left
checkbox 7 8 79 42 11 "AC1" ac1
checkbox 8 8 92 42 11 "AC2" ac2
checkbox 9 8 106 42 11 "Summary" sum
;text 10 8 121 52 17 "Enter your RLI: (0-255)" center
;editbox 12 59 119 34 11 rli
;text 13 84 2 80 11 "Enter NPA, NXX or SPN" left
;checkbox 14 90 16 56 11 "NPA" npa
;checkbox 15 90 29 56 11 "NXX" nxx
;checkbox 16 90 43 56 11 "SPN" spn
;text 17 90 63 94 11 "Do you have Deny codes?" left
;checkbox 18 90 78 25 11 "Yes" yesdeny
;checkbox 19 122 78 25 11 "No" nodeny
;text 20 185 2 96 18 "Enter the Range of Numbers: (in the format xxx-xxx) " center
;editbox 21 185 25 88 11 range
;text 22 185 63 90 11 "Are you already Logged in?" left
;checkbox 23 230 79 28 11 "YES" logyes
; checkbox 24 188 79 26 11 "NO" logno
pushbutton 26 200 119 40 13 "OK" OK DEFAULT
pushbutton 27 200 141 40 13 "Cancel" CANCEL
enddialog



while 1
dlgevent 0 reqint
switch reqint
case 0

endcase
case 2
case 3
case 4
case 5
endcase
default
exitwhile
endcase
endswitch
endwhile
;dlgdestroy 0 CANCEL
IF new
usermsg " you selected new"
elseif chg
usermsg " You selected chg"
elseif prt
usermsg "You selected prt"
elseif out
usermsg "You selected out"
else
usermsg "You forgot to enter a Request for the switch!"
endif


while 1
dlgevent 0 tran
switch tran
case 0

endcase
case 7
case 8
case 9

endcase
default
exitwhile
endcase
endswitch
endwhile
;dlgdestroy 0 CANCEL
IF AC1
usermsg " you selected AC1"
elseif AC2
usermsg " You selected AC2"
elseif SUM
usermsg "You selected SUM"

else
usermsg "You forgot to enter a TRAN type for the switch!"
endif
;itoa new newa
if (reqint)||(tran)

else
goto strartover
endif
endproc




Thank you for the help,
Woodro
 
Probably the easiest thing to do (if I understand your request correctly) is to make sure your script only exits the dialog box after making sure that all variables that need to be set are set. This also means you won't be taking any action on the parameters until after the user presses the OK button.

The first thing I would do is restructure your case statment so that the only way to exit the while loop is to click either the OK or Cancel button. I would change your default case statement to not perform the exitwhile command - that should only be used for case 26 and case 27. To make sure that the dialog should close when the OK button is pressed, case 26 should make sure that new, chg, print, or out have been selected and that AC1, AC2, or summary has been selected. If so, then you would want to use the exitwhile command.

After you've made the above changes, you could then pull some of the if/else statements back into the case statement. For example:

IF new
usermsg " you selected new"

could be included under the case 2 statement, unless you would rather all of this feedback be provided when the dialog is closed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top