What is the preferred way to add code for handling a push-button click or key press?
There are 3 ways to tie code to the action of a user hitting a push-button.
From most preferred to least preferred they are:
Double-click on the control to add a Link To paragraph (or add it by clicking on Link To in the properties view), and enter a number for the exception-value property
Add a cmd-clicked exception paragraph (automatically adds an Exception procedure)
Add a cmd-clicked event paragraph (automatically adds an Event procedure)
Functionally, the difference between Link-To and Cmd-Clicked procedures is that Link-To allows you to manually assign an exception value. You do this by entering the number of your choice (values greater than 100 are common) in the exception-value property field. If I enter an exception-value of 1000 then the generated code looks something like this:
perform until exit-pushed
on exception perform is-screen-3-evaluate-func
if event-type = cmd-close
when key-status = 1000
move 1 to accept-control.
set exit-pushed to true.
modify screen-3-lb-1 item-to-add "Hello".
With manually assigned exception values it is possible to have a menu entry and/or function key generate the same exception value so that the user could perform the function in more than one way. In fact, "Link To" is the preferred way to specify a paragraph to execute when the user selects a menu entry.
by: Veryant Support
This question has been viewed 5026 times so far.
Here to View all the questions in Screen Programs
There are no attachment file(s) related to this question.
There are no user comments for this question. Be the first to post a comment. Click Here