Kbase 6226: Sample Pick and Choose APPLHELP with CHOOSE and SCROLL
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
Sample Pick and Choose APPLHELP with CHOOSE and SCROLL
910213-JEP01
INTRODUCTION: Date Last Modified: 2/13/91
=============
This Product Services Technical Support Knowledgebase entry explains
how to implement simple Pick and Choose routines using PROGRESS.
WHY YOU'LL NEED TO DO THIS:
===========================
Often times you'll want to give users a list of entries or choices
while they are being prompted for data in a field. You can
accomplish this using a Choices Window.
PROCEDURAL APPROACH:
===================
The following procedures demonstrate how simple Choices Windows
can be implemented.
/* cust1.p
The user can press the HELP (F2) key when prompted for a customer
number and a choice list (from applhelp.p) appears. The user
chooses a value and it is passed back to the input value of the
calling procedure using the FRAME-VALUE = FRAME-VALUE statement
in the applhelp.p procedure.
*/
REPEAT WITH FRAME f-customer:
PROMPT-FOR customer.cust-num
HELP "Enter Customer Number or press HELP (F2) for Choices.".
FIND customer WHERE customer.cust-num = INPUT cust-num NO-ERROR.
IF AVAILABLE customer THEN UPDATE name sales-rep.
ELSE
DO:
MESSAGE "No such customer. Please re-enter".
UNDO, RETRY.
END.
END.
(1)
/* applhelp.p
This procedure is initiated when the user presses the HELP (F2) key
while being prompted for customer number. It displays a window of
customers and allows the user to choose the one they want. The
choices window is a scrolling one, so more than just the 5 records
originally displayed can be seen by using the cursor up/down keys.
*/
FORM customer.cust-num customer.name
WITH FRAME cust-frame 5 DOWN ROW 10 CENTERED
OVERLAY TITLE " Available Customers ".
REPEAT WHILE FRAME-LINE(cust-frame) <= FRAME-DOWN(cust-frame):
FIND NEXT customer NO-LOCK.
DISPLAY customer.cust-num customer.name WITH FRAME cust-frame.
DOWN WITH FRAME cust-frame.
END.
UP 5 WITH FRAME cust-frame.
REPEAT:
CHOOSE ROW customer.cust-num NO-ERROR WITH FRAME cust-frame.
COLOR DISPLAY NORMAL customer.cust-num WITH FRAME cust-frame.
FIND customer WHERE customer.cust-num = INPUT customer.cust-num
NO-LOCK.
IF KEYFUNCTION(LASTKEY) = "CURSOR-UP" THEN
DO:
FIND PREV customer NO-LOCK NO-ERROR.
IF AVAILABLE customer THEN
DO:
SCROLL DOWN WITH FRAME cust-frame.
DISPLAY customer.cust-num customer.name WITH FRAME cust-frame.
END.
ELSE FIND NEXT customer NO-LOCK NO-ERROR.
END.
ELSE
IF KEYFUNCTION(LASTKEY) = "CURSOR-DOWN" THEN
DO:
FIND NEXT customer NO-LOCK NO-ERROR.
IF AVAILABLE customer THEN
DO:
SCROLL UP WITH FRAME cust-frame.
DISPLAY customer.cust-num customer.name WITH FRAME cust-frame.
END.
ELSE FIND PREV customer NO-LOCK NO-ERROR.
END.
ELSE
IF LOOKUP( KEYFUNCTION(LASTKEY), "RETURN,GO") > 0 THEN
DO:
FRAME-VALUE = FRAME-VALUE. /* This assigns the selected value. */
HIDE FRAME cust-frame NO-PAUSE.
RETURN.
END.
END.
IF KEYFUNCTION(LASTKEY) = "END-ERROR" THEN
HIDE FRAME cust-frame NO-PAUSE.
(2)
ON-LINE PROCEDURES OR UTILITIES:
===============================
PROGRESS Procedure Library
REFERENCES TO WRITTEN DOCUMENTATION:
===================================
Language Reference: SCROLL and CHOOSE statements
Language Tutorial: Chapter on Providing Help Information for an
Application
Progress Software Technical Support Note # 6226