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!

Dialogue box 1

Status
Not open for further replies.

PhilBreau

Technical User
Dec 14, 2001
108
CA
I am trying to create a dialogue box with multiple editbox fields. The sample in Procomm help shows how to use 1 edit box. When I try to use 3 edit boxes, the script closes the dialogue box and continues to execute after filling in 2 editboxes and clicking on the third.

Sample from Procomm help:

proc main
string TextStr ; Text from dialog box.
integer Event ; Dialog box event.

; Define and display dialog with edit box.
dialogbox 0 0 0 100 70 11 "Edit Box Example"
editbox 1 5 5 90 40 TextStr MULTILINE
pushbutton 2 25 50 50 14 "E&xit"
enddialog
while 1
dlgevent 0 Event ; Read dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase

case 1 ; Edit box was changed.
endcase
default ; Exit event selected.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy dialog box.
if not nullstr TextStr ; See that TextStr isn't empty.
usermsg "You typed:`r`r%s" TextStr
else
usermsg "No text entered."
endif
endproc


My sample:

proc main
string TextStr ; Text from dialog box.
string TextStr2
string TextStr3

integer Event ; Dialog box event.

dialogbox 0 7 25 150 112 11 "Edit Box Example"
editbox 1 12 30 97 9 TextStr
editbox 2 15 49 90 9 TextStr2
editbox 3 15 66 90 9 TextStr3
pushbutton 4 43 88 50 14 "E&xit"
enddialog

while 1
dlgevent 0 Event ; Read dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase

case 1 ; Edit box was changed.
endcase
default ; Exit event selected.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy dialog box.
if not nullstr TextStr ; See that TextStr isn't empty.
usermsg "You typed:`r`r%s" TextStr
else
usermsg "No text entered."
endif
endproc

Please help. Thank you
 
You need to add case statements to handle the second and third edit fields, in other words:

case 2
endcase
case 3
endcase

need to be present before the default case statement. These additional case statements are needed because the second and third edit fields were assigned id values of 2 and 3. Since there were no case statements for those specific values, the default case statement would fire and exit the while loop. No case statement is required for the Exit pushbutton because it is handled by the default case. With the changes above, I was able to successfully assign values to all three edit fields.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top