This example simulates the way the appearance of an SCL program can be affected by color. View the program first in black and white, then in color.


Black & white | Color | Return to technical note


*
  MAIN.APPL.MENU.FRAME
  Window displays list of applications.
  User selects application to launch.
  November 4-6, 1998
  Rick Aster
 
  Window variables:
  SELECT   List box: user can select one application
  GO       Go button
  EXIT     Exit button
*;



length
    selection $ 25
    ;

 

init:
*
  Select most recently selected item in list box as default.
*;

select_list = makelist();
rc = fillist('CATALOG', 'SASUSER.MAIN.SELECT.SLIST', select_list);
if listlen(select_list >= 1) then
    selection = getitemc(select_list);
call notify('SELECT', '_UNSELECT_ALL_');
call notify('SELECT', '_GET_ROW_', selection, selected_row);

*
  If there is no stored selection or if it is not in the list,
  select the last item in the list.
*;

call notify('SELECT', '_GET_MAXROW_', list_box_row_count);
if selected_row = 0 then selected_row = list_box_row_count;
call notify('SELECT', '_SELECT_ROW_', selected_row);
return;

 

SELECT:
*
  Ungray Go button if an application is selected.
*;

call notify('SELECT', '_SELECTED_', 1, selected_row);
if selected_row = 0 then call notify('GO', '_GRAY_');
else call notify('GO', '_UNGRAY_');
stop;

 

GO:
*
  Get selection and respond.
*;

call notify('SELECT', '_SELECTED_', 1, selected_row);
call notify('SELECT', '_GET_TEXT_', selected_row, selection);
rc = clearlist(select_list);
rc = insertc(select_list, selection, 1);
if rc = select_list then rc =
    savelist('CATALOG', 'SASUSER.MAIN.SELECT.SLIST', select_list);
select(selection);
   when('Rock/Pop') goto
rock;
   when('Hip-Hop') goto
hop;
   when('Country') goto
country;
   when('Disco') goto
disco;
   when('Easy Listening') goto
easy;
   otherwise goto
e_noapp;
   end;

 

rock:
submit continue;
LIBNAME POP '!server\db\pop';
LIBNAME ROCK '!server\db\rock';
LIBNAME METAL '!server\db\metal';
LIBNAME STD '!server\db\std';

endsubmit;
call display('MAIN.ROCK.INIT.SCL');
submit continue;

LIBNAME POP CLEAR;
LIBNAME ROCK CLEAR;
LIBNAME METAL CLEAR;
LIBNAME STD CLEAR;

endsubmit;
goto
reset;
 

hop:
submit continue;
LIBNAME HIPHOP '!server\db\hiphop';
LIBNAME RAP '!server\db\rap';

endsubmit;
call display('MAIN.HOP.INIT.SCL');
submit continue;

LIBNAME HIPHOP CLEAR;
LIBNAME RAP CLEAR;

endsubmit;
goto
reset;
 

country:
submit continue;
LIBNAME COUNTRY '!server\db\country';
endsubmit;
call display('MAIN.COUNTRY.INIT.SCL');
submit continue;

LIBNAME COUNTRY CLEAR;
endsubmit;
goto
reset;
 

disco:
submit continue;
LIBNAME DISCO '!server\db\dance\disco';
LIBNAME TECHNO '!server\db\dance\techno';
LIBNAME HOUSE '!server\db\dance\house';

endsubmit;
call display('MAIN.DISCO.INIT.SCL');
submit continue;

LIBNAME DISCO CLEAR;
LIBNAME TECHNO CLEAR;
LIBNAME HOUSE CLEAR;

endsubmit;
goto
reset;
 

easy:
submit continue;
LIBNAME EASY '!server\db\easy';
LIBNAME NEWAGE '!server\db\new-age';

endsubmit;
call display('MAIN.EASY.INIT.SCL');
submit continue;

LIBNAME EASY CLEAR;
LIBNAME NEWAGE CLEAR;

endsubmit;
goto
reset;
 

reset:
selected_row + 1;
if selected_row > list_box_row_count then selected_row = 1;
call notify('SELECT', '_SELECT_ROW_', selected_row);
stop;

 

main:
return;
 

EXIT:
term:

_status_ = 'H';
return;

 

*
  Error routine.
*;

e_noapp:
_msg_ = 'ERROR: Selected application is not installed correctly.';
goto
reset;
 


Return to technical note

 O /\

Global
Statements

RICK ASTER

SAS

BOOKS

Tech

Download | Rastinate

Techniques

Projects

Also see:

Start Here

Q & A

Rick Aster