space
Previous Page | Next Page

Adding SAS Component Language Programs to Frames

Calling Other Entries and Opening Windows

You can use SCL to access other entries that you may need for your application, such as frames and other SCL programs. You can use the DISPLAY routine to invoke another SAS catalog entry, including FRAME, SCL, CBT, and PROGRAM entries. For example,

   call display('sasuser.mycat.myApp.scl');

invokes the SCL entry named myApp. The calling program transfers control to myApp and waits for it to finish processing.

SCL also enables you to pass parameters between different entry types. In general, any argument to an SCL function, routine, or method can be

Character constants, numeric constants, and expressions are passed by value. You can use any SCL variable to pass parameters by reference to another entry. To use the DISPLAY function with a return value, you must include an ENTRY statement in the frame SCL of the called FRAME entry. For example, consider the following SCL code:

   validUser=DISPLAY('password.frame', userid);

If PASSWORD.FRAME contained a text entry control named userPassword in which a user could provide a valid password, the frame's SCL could contain

/* FRAME SCL for mylib.mycat.password.frame */
entry userid:input:num return=num;
term:
   dcl char pwd;
   dcl num isValid;
   /* Assume that the user ID is validated in some */
   /* way to establish a value for the password.   */
   if userPassword.text = pwd
      then isValid=1;
      else isValid=2;
return(isValid);

For details on passing parameters to other SAS catalog entries, see the ENTRY statement in SAS Component Language: Reference.


Opening Other Windows

Your applications can consist of any number of windows and dialog boxes. Using the DISPLAY routine, you can open other windows in your application as needed.

For example, assume that a frame contains three push button controls named Rates, Lenders, and Recalculate. The SCL entry for that frame can call a FRAME entry named LOANRATES.FRAME when a user clicks the Rates button, and it can call a FRAME entry named LENDERINFO.FRAME when a user clicks Lenders. The frame SCL also runs another SCL entry when a user clicks Recalculate.

RATES:
   call display('loanRates.frame');
return;

LENDERS:
   call display('lenderInfo.frame', 2, 'North', listBox1.selectedItem);
return;

RECALCULATE:
   call display('sasuser.myapp.calculate.scl');
return;

You can also invoke full-screen applications from a SAS/AF frame application. For example, the following SCL code enables a user to access the FSEDIT window and to browse the RECORDS.CLIENTS table after clicking Clients on the active frame:

CLIENTS:
  call fsedit('records.clients',",'browse');
return;


Calling Dialog Boxes from an Application

You can present information in SAS/AF applications through dialog boxes as well as through standard frames. Your SCL code can call dialog boxes using any of the following:

For complete information on these functions, see SAS Component Language: Reference.

space
Previous Page | Next Page | Top of Page