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

I'm trying to create a dialogue box 1

Status
Not open for further replies.

PhilBreau

Technical User
Dec 14, 2001
108
CA
I'm trying to create a dialogue box with 2 push buttons and an edit box. When I select the push buttons only, I get the result I want. When I enter text, and select either push button the only event result I get is the edit box ID. It's easy enough to create another dialogue box later to select m/f, but I want to do it all in 1.



Sample:



string name
integer eventid


dialogbox 30 8 20 264 169 2 "PUSHBUTTON TEST"
text 32 38 30 160 11 "Please type your name." left
editbox 33 31 55 194 14 name
pushbutton 34 51 129 40 13 "Male"
pushbutton 35 143 130 40 13 "Female"
text 36 84 111 105 11 "Select your gender" left
enddialog




while 1 ; Loop forever.
dlgEvent 30 EventID ; Get dialog EventID.
switch EventID ; Evaluate the EventID.
case 0 ; No EventID occurred.
endcase
default ; Dialog EventID occurred.

exitwhile ; Exit the while loop.
endcase
endswitch
endwhile

dlgdestroy 30 CANCEL ; Destroy dialog box.



usermsg "event id %d" eventid

if eventid==34
usermsg "MALE"
endif

if eventid==35
usermsg "FEMALE"
endif

usermsg name






BTW Knob, you have been a great help on the telnet script. Thank you :)
 
What is happening is that the default case statement you have is firing whenever any dialog event occurs (a name entered or a button pushed). ASPECT decides somehow (I am guessing by the lowest ID) which event fired first and that is why it appears the push button event is not activating. If you add:

case 33
endcase

somewhere before your default case statement, then nothing will occur when a name is entered and you will remain in the while loop until a button is pressed.

Glad to hear that the telnet script is working for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top