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

Aspect Script Dialog Box Event Handling Confusion 1

Status
Not open for further replies.

krayten

Technical User
Apr 30, 2004
13
0
0
GB
Hi,
I'm pretty new to aspect scripting and would appreciate some advice on how to handle dialog box events.

The script below shows a simple dialog box with some pushbuttons. Button 16 is a simple QUIT function. All I want is for the case handler to realise that choice returned 16, the user pressed QUIT, then to show the usermsg "wanna quit".

I cant seem to get that to work. I'm pretty sure that if I can see how to get that single event to "fire" then I'll see how to handle all the other events.

Hoping someone can help me.

Thanks,
K


proc main

integer choice

showwelcome()

dlgevent 0 choice
switch choice
case 16
usermsg "wanna quit?"
endcase

endswitch


endproc

proc showwelcome
dialogbox 0 10 20 399 163 67 "Meridian 1 Script by Kryten"
text 3 138 13 122 11 "Meridian 1 All Purpose Aspect Script" left
text 4 2 33 134 11 "What would you like to work with today?" left
pushbutton 5 12 72 120 13 "OUT Analog Teles"
text 6 38 55 68 11 "Analog Telephones" left
pushbutton 7 12 87 120 13 "CHG Analog Tele CLS's"
text 8 163 55 68 11 "Digital Telephones" left
pushbutton 9 138 72 120 13 "OUT Digital Teles"
pushbutton 10 138 87 120 13 "CHG Digital Teles CLS's"
pushbutton 11 12 102 120 13 "AST + IAPG Settings"
pushbutton 12 138 103 120 13 "AST + IAPG Settings"
text 13 292 55 68 11 "Steering Codes" left
pushbutton 14 264 72 120 13 "CHG Distant Steering Codes"
pushbutton 15 264 87 120 13 "OUT Distant Steering Codes"
pushbutton 16 264 144 120 13 "Quit"
enddialog
endproc






 
Code:
dialogbox 0 10 20 399 163 67 "Meridian 1 Script by Kryten"

Change the style to 3 instead of 67. 64 prevents the script from running until the dialog box is destroyed, so you never get to your switch statement.

Also, consider making this change:

Code:
while 1
dlgevent 0 choice
switch choice
  case 16
   usermsg "wanna quit?"
   exitwhile
  endcase
  
endswitch
endwhile
 
Spot On. I think I understand why what you have suggested works too, so thats good.

Many thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top