support: Customer Portal
Focused on delivering choice, investment protection and flexibility to organizations with valuable COBOL assets
 

Veryant Knowledge Base
Home > All Categories > isCOBOL IDE > Screen Programs > What is the preferred way to add code for handling a push-button click or key press?
Question Title 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:

  1. 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
  2. Add a cmd-clicked exception paragraph (automatically adds an Exception procedure)
  3. 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:

       is-screen-3-proc.
           perform until exit-pushed
              accept screen-3
              on exception perform is-screen-3-evaluate-func
              end-accept
           end-perform.
           destroy window-handle.
           initialize key-status.
       is-screen-3-evaluate-func.
           evaluate true
           when exit-pushed
              perform is-screen-3-exit
           when event-occurred
              if event-type = cmd-close
                 perform is-screen-3-exit
              end-if
              when key-status = 1000
                 perform screen-3-pb-2-link-to
           end-evaluate.
           move 1 to accept-control.
       is-screen-3-exit.
           set exit-pushed to true.

        screen-3-pb-1-link-to.
             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.

Authored by: Veryant Support This question has been viewed 5026 times so far.
Click Here to View all the questions in Screen Programs category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
How helpful was this article to you?
User Comments User Comments Add Comment
There are no user comments for this question. Be the first to post a comment. Click Here
Related Questions Related Questions
  1. How can I move controls into or out of a frame?
  2. Ability to copy a screen from one program to another, having a program with 2 screens designed and wanting to include those screens in another program.
  3. Did you know you can easily align controls in the IDE Screen Painter and Report Painter?
Article Information Additional Information
Article Number: 131
Created: 2010-06-04 4:06 PM
Rating: 5 Stars
 
Article Options Article Options
Print Question Print this Question
Email Question Email Question to Friend
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
Subscribe to Article Subscribe to Article
 
Search Knowledge Base Search Knowledge Base



 
 

© Veryant - All Rights Reserved
Veryant and isCOBOL are trademarks or registered marks of Veryant in the United States and other countries. All other marks are the property of their respective owners.