By Barry Rochford
Ok, you have a nice Menu Form set up for your Application and the only thing left is: Close Alpha Five. Here's one way to do it while asking the Operator to Confirm that they really meant to Exit and didn't just click in the wrong place.
I usually use Hotspots on my Menus. Remember, a Hotspot changes the cursor to a pointing finger as you pass over it. Others may use Buttons. Whichever method works for you is the best way.
Figure 1 shows a Sample Form in design mode. Steps 1 3 graphically depict the actions necessary to build a Hotspot with an Alpha Supplied BMP Image. I used Tool166 (a small EXIT Sign).
Fig. 1 Test Form in Design Mode
Just like Buttons, Hotspots have Events. We will add a short Xbasic script to the OnPush Event for the Hotspot on the Sample Form.
Click on the Hotspot to select it. Then Right-click and select Actions. There is only an OnPush event so click on Code, Convert to Xbasic. In the code editor window for the OnPush event enter the following Xbasic coding:
msg_code=ui_yes_no+ui_question_symbol+ui_first_button_default
response=ui_msg_box("Confirm","Do You Want to Exit To WINDOWS?",msg_code)
if response <> ui_yes_selected then
end
end if
:controlpanel.show()
Parent.close()
:A5.close()
end
This short script will display a Message asking for Confirmation, if the NO button is pressed, the script ends. If the YES button is pressed, the control panel is set to show. Most of my Applications hide the control panel [ :controlpanel.hide()], so I have to remember to show it before shutting down Alpha 5. Then the Parent of the Hotspot, our Sample Form, is closed, then Alpha5 itself is closed.
If you use a button, the same script will work just fine.
Heres something you can experiment with for the UI_msg_box. Do you know that you can place line breaks and tabs in a UI_msg_box? A tab is CHR(9), line break is CHR(10).
Change the ui_msg_box in the script above to read:
response=ui_msg_box("Confirm",\
"Do You Want to Exit To"+chr(10)+chr(10)+"WINDOWS?",msg_code)
(My Thanks go to Steve Workings for this idea.)
| Barry is an Alpha Developer living close to Newtown, PA. He can be reached at brochford@enter.net |
7/3/99
Don't forget, we need your feedback to make this site better!