Reusable Part VL_SAM027: Status Bar Details

LANSA

Reusable Part VL_SAM027: Status Bar Details
Name: VL_SAM027

Description: The following RDMLX reusable component is used to put a standardized progress bar, date/time indicator and stop/go lights onto a form's status bar.

This reusable component uses visual style VS_NOREAD

This reusable component is used by form VL_SAM028.

FUNCTION OPTIONS(*DIRECT);
BEGIN_COM DISPLAYPOSITION(1) HEIGHT(18) LEFT(0) TABPOSITION(1) TOP(0) VISUALSTYLE(#VS_GROUP) WIDTH(235);
DEFINE_COM CLASS(#PRIM_PGBR) NAME(#PROGRESS) DISPLAYPOSITION(1) HEIGHT(17) LEFT(0) MAXIMUMVALUE(100) MINIMUMVALUE(0) PARENT(#COM_OWNER) TABPOSITION(1) TABSTOP(False) TOP(0) VALUE(0) VISUALSTYLE(#VS_NORM) VISUALSTYLEOFPARENT(False) WIDTH(104);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#IMG_STOP) DISPLAYPOSITION(3) HEIGHT(17) LEFT(219) PARENT(#COM_OWNER) TABPOSITION(3) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_NORM) VISUALSTYLEOFPARENT(False) WIDTH(15);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#IMG_GO) DISPLAYPOSITION(2) HEIGHT(17) LEFT(219) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(0) WIDTH(15);
DEFINE_COM CLASS(#PRIM_TIMR) NAME(#TIMER) INTERVAL(0);
DEFINE_COM CLASS(#DATETIME.Visual) NAME(#DATETIME) DISPLAYPOSITION(4) HEIGHT(17) LEFT(103) MARGINLEFT(0) PARENT(#COM_OWNER) READONLY(True) TABPOSITION(4) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_NOREAD) VISUALSTYLEOFPARENT(False) WIDTH(114);
;
* Simple field definitions ;
;
Define #TrueFalse *char 5;
Define #ProgPct reffld(#std_num) ;
Define #TimeFreq reffld(#std_num) ;
Define #Busy reffld(#truefalse);
def_cond *Busy '#Busy = true' ;
;
* Property Definitions;
;
Define_Pty Busy set(SetBusy) desc('Busy State') help('Set this property to TRUE or FALSE to indicate whether your logic is busy or not');
Define_Pty ProgressPercent set(SetProgress) desc('Progress Percentage') help('Set the progress percentage complete. Value should be in range 1 to 100 only.');
Define_Pty TimeUpdateFreq set(SetTimeFreq) desc('Time Update Frequency') help('Time update frequency. Value is in seconds and should be in range 1 to 60. Special value 0 halts time updating completely.');
;
* Initialization Subroutine ;
;
SubRoutine Initialize;
define #InitDone *char 1;
if '#InitDone *ne Y';
change #InitDone Y ;
change #sysvar$av *part_dir_execute;
use tconcat (#sysvar$av 'stopligh.bmp') (#sysvar$av);
set #img_stop filename(#sysvar$av);
change #sysvar$av *part_dir_execute;
use tconcat (#sysvar$av 'golight.bmp') (#sysvar$av);
set #img_go filename(#sysvar$av);
set #com_owner busy(false);
set #com_owner TimeUpdateFreq(5);
endif ;
Endroutine ;
;
* Set busy state to true or false;
;
PtyRoutine SetBusy ;
Define_Map *input #Std_Texts #pSetBusy;
Execute Initialize ;
Change #busy #pSetBusy.Value;
use uppercase (#busy) (#busy);
set #Progress value(0);
if *busy;
set #img_go visible(false);
set #img_stop visible(true) ;
else ;
set #img_stop visible(false) ;
set #img_go visible(true);
endif ;
endroutine ;
;
* Set progress bar to new position ;
;
PtyRoutine SetProgress;
Define_Map *input #Std_Num #pProgPct;
Execute Initialize ;
Change #ProgPct #pProgPct.Value;
case #ProgPct;
when '< 1';
change #ProgPct 1 ;
when '> 100';
change #ProgPct 100 ;
otherwise ;
endcase ;
set #Progress value(#ProgPct) ;
endroutine ;
;
PtyRoutine SetTimeFreq;
Define_Map *input #Std_Num #pTimeFreq;
Execute Initialize ;
Change #TimeFreq #pTimeFreq.Value;
case #TimeFreq;
when '< 0';
change #TimeFreq 0 ;
when '> 60';
change #TimeFreq 60 ;
otherwise ;
endcase ;
Change #TimeFreq '#TimeFreq * 1000';
Set #timer interval(#TimeFreq) ;
endroutine ;
;
* Update time/date ;
;
evtroutine handling(#timer.tick) options(*noclearmessages *noclearerrors);
change #datetime *datetime ;
endroutine ;
;
END_COM ;