Form VL_SAM065: Dynamic Radio Button Groups
Name: VL_SAM065
Description: The following RDMLX form is used to demonstrate how reusable component VL_SAM064 can be used to dynamically create groups of radio buttons.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM HEIGHT(543) LEFT(340) TOP(102) WIDTH(311);
DEFINE_COM CLASS(#VL_SAM064) NAME(#SEX) LEFT(168) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(16);
DEFINE_COM CLASS(#VL_SAM064) NAME(#SHOE) DISPLAYPOSITION(3) LEFT(8) PARENT(#COM_OWNER) TABSTOP(False) TOP(16);
DEFINE_COM CLASS(#VL_SAM064) NAME(#TUBE) DISPLAYPOSITION(4) LEFT(168) PARENT(#COM_OWNER) TABPOSITION(3) TABSTOP(False) TOP(85);
DEFINE_COM CLASS(#VL_SAM064) NAME(#EMP) DISPLAYPOSITION(5) LEFT(168) PARENT(#COM_OWNER) TABPOSITION(4) TABSTOP(False) TOP(178);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) CAPTION('Internal Code Values ') DISPLAYPOSITION(2) HEIGHT(135) LEFT(-1) PARENT(#COM_OWNER) TABPOSITION(5) TABSTOP(False) TOP(375) WIDTH(152);
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#SEXCODE) CAPTION('Sex Code') DISPLAYPOSITION(1) HEIGHT(19) LABELTYPE(Caption) LEFT(7) MARGINLEFT(80) PARENT(#GPBX_1) READONLY(True) TABPOSITION(1) TABSTOP(False) TOP(51) WIDTH(135);
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#SHOECODE) CAPTION('Shoe Code') DISPLAYPOSITION(3) HEIGHT(19) LABELTYPE(Caption) LEFT(7) MARGINLEFT(80) PARENT(#GPBX_1) READONLY(True) TABPOSITION(3) TABSTOP(False) TOP(24) WIDTH(97);
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#TUBECODE) CAPTION('X Section Code') DISPLAYPOSITION(2) HEIGHT(19) LABELTYPE(Caption) LEFT(7) MARGINLEFT(80) PARENT(#GPBX_1) READONLY(True) TABPOSITION(2) TABSTOP(False) TOP(78) WIDTH(97);
DEFINE_COM CLASS(#EMPNO.Visual) NAME(#EMPNO) DISPLAYPOSITION(4) HEIGHT(19) LEFT(7) MARGINLEFT(90) PARENT(#GPBX_1) READONLY(True) TABPOSITION(4) TABSTOP(False) TOP(104) WIDTH(138);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_1) DISPLAYPOSITION(2) DRAWTYPE(TriangleDown) FRAMEHEIGHTBOTTOM(4) FRAMEHEIGHTTOP(4) FRAMEWIDTHLEFT(4) FRAMEWIDTHRIGHT(4) LEFT(48) LINETYPE(Solid) LINEWIDTH(3) PARENT(#PANEL) TABPOSITION(2) TABSTOP(False) TOP(180) WIDTH(51);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_2) DISPLAYPOSITION(1) DRAWTYPE(Rectangle) FRAMEHEIGHTBOTTOM(4) FRAMEHEIGHTTOP(4) FRAMEWIDTHLEFT(4) FRAMEWIDTHRIGHT(4) HEIGHT(95) LEFT(62) LINETYPE(Solid) LINEWIDTH(3) PARENT(#PANEL) TABPOSITION(1) TABSTOP(False) TOP(88) WIDTH(21);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('These details are shown so that you can see what is happening inside the form when radio buttons are selected.') DISPLAYPOSITION(3) HEIGHT(65) LEFT(16) PARENT(#PANEL) TABPOSITION(3) TABSTOP(False) TOP(8) WIDTH(121);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANEL) DISPLAYPOSITION(6) HEIGHT(241) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(6) TABSTOP(False) TOP(128) VISIBLE(False) WIDTH(145);
DEFINE_COM CLASS(#PRIM_TIMR) NAME(#TIMER) INTERVAL(10000);
;
Define #Counter RefFld(#Std_Num) ;
;
EVTROUTINE handling(#com_owner.Initialize);
SET #com_owner caption(*component_desc);
* Dynamically build Sex Group ;
Set #Sex GroupCaption('Sex');
Invoke #Sex.AddRadioButton UseCaption('&Male Student') UseCode(MALE) ;
Invoke #Sex.AddRadioButton UseCaption('&Female Student') UseCode(FEMALE);
Set #Sex CurrentCode(FEMALE);
* Dynamically build Shoe Group ;
Set #Shoe GroupCaption('Shoe Size');
Invoke #Shoe.AddRadioButton UseCaption('Small (S)') UseCode(S) ;
Invoke #Shoe.AddRadioButton UseCaption('Medium (M)') UseCode(M) ;
Invoke #Shoe.AddRadioButton UseCaption('Large (L)') UseCode(L) ;
Invoke #Shoe.AddRadioButton UseCaption('Extra Large (X)') UseCode(X) ;
Set #Shoe CurrentCode(L);
* Dynamically build Tube Cross Section Group ;
Set #Tube GroupCaption('Tube Cross Section');
Invoke #Tube.AddRadioButton UseCaption('&Round') UseCode(R) ;
Invoke #Tube.AddRadioButton UseCaption('&Square') UseCode(S);
Invoke #Tube.AddRadioButton UseCaption('&Triangular') UseCode(T);
Set #Tube CurrentCode(R);
* Dynamically build Employees Group (not a real world example, but shows flexibility of the reusable component ;
Change #Counter 0;
Set #Emp GroupCaption('Employees');
Select (#Empno #SurName) From_File(PSLMST);
Invoke #Emp.AddRadioButton UseCaption(#SurName) UseCode(#Empno) ;
Change #Counter '#Counter + 1';
Leave if('#Counter = 16');
EndSelect;
Set #Emp CurrentCode(#Empno);
ENDROUTINE ;
;
EvtRoutine Handling(#Sex.CodeChanged) NewCode(#NewSex);
Set #SexCode Value(#NewSex.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Shoe.CodeChanged) NewCode(#NewShoe);
Set #ShoeCode Value(#NewShoe.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Tube.CodeChanged) NewCode(#NewTube);
Set #TubeCode Value(#NewTube.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Emp.CodeChanged) NewCode(#NewEmp);
Set #Empno Value(#NewEmp.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Timer.Tick) ;
if '#Panel.Visible = True';
Set #Panel Visible(False);
else;
Set #Panel Visible(True);
endif ;
EndRoutine ;
;
END_COM ;
Name: VL_SAM065
Description: The following RDMLX form is used to demonstrate how reusable component VL_SAM064 can be used to dynamically create groups of radio buttons.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM HEIGHT(543) LEFT(340) TOP(102) WIDTH(311);
DEFINE_COM CLASS(#VL_SAM064) NAME(#SEX) LEFT(168) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(16);
DEFINE_COM CLASS(#VL_SAM064) NAME(#SHOE) DISPLAYPOSITION(3) LEFT(8) PARENT(#COM_OWNER) TABSTOP(False) TOP(16);
DEFINE_COM CLASS(#VL_SAM064) NAME(#TUBE) DISPLAYPOSITION(4) LEFT(168) PARENT(#COM_OWNER) TABPOSITION(3) TABSTOP(False) TOP(85);
DEFINE_COM CLASS(#VL_SAM064) NAME(#EMP) DISPLAYPOSITION(5) LEFT(168) PARENT(#COM_OWNER) TABPOSITION(4) TABSTOP(False) TOP(178);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) CAPTION('Internal Code Values ') DISPLAYPOSITION(2) HEIGHT(135) LEFT(-1) PARENT(#COM_OWNER) TABPOSITION(5) TABSTOP(False) TOP(375) WIDTH(152);
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#SEXCODE) CAPTION('Sex Code') DISPLAYPOSITION(1) HEIGHT(19) LABELTYPE(Caption) LEFT(7) MARGINLEFT(80) PARENT(#GPBX_1) READONLY(True) TABPOSITION(1) TABSTOP(False) TOP(51) WIDTH(135);
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#SHOECODE) CAPTION('Shoe Code') DISPLAYPOSITION(3) HEIGHT(19) LABELTYPE(Caption) LEFT(7) MARGINLEFT(80) PARENT(#GPBX_1) READONLY(True) TABPOSITION(3) TABSTOP(False) TOP(24) WIDTH(97);
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#TUBECODE) CAPTION('X Section Code') DISPLAYPOSITION(2) HEIGHT(19) LABELTYPE(Caption) LEFT(7) MARGINLEFT(80) PARENT(#GPBX_1) READONLY(True) TABPOSITION(2) TABSTOP(False) TOP(78) WIDTH(97);
DEFINE_COM CLASS(#EMPNO.Visual) NAME(#EMPNO) DISPLAYPOSITION(4) HEIGHT(19) LEFT(7) MARGINLEFT(90) PARENT(#GPBX_1) READONLY(True) TABPOSITION(4) TABSTOP(False) TOP(104) WIDTH(138);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_1) DISPLAYPOSITION(2) DRAWTYPE(TriangleDown) FRAMEHEIGHTBOTTOM(4) FRAMEHEIGHTTOP(4) FRAMEWIDTHLEFT(4) FRAMEWIDTHRIGHT(4) LEFT(48) LINETYPE(Solid) LINEWIDTH(3) PARENT(#PANEL) TABPOSITION(2) TABSTOP(False) TOP(180) WIDTH(51);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_2) DISPLAYPOSITION(1) DRAWTYPE(Rectangle) FRAMEHEIGHTBOTTOM(4) FRAMEHEIGHTTOP(4) FRAMEWIDTHLEFT(4) FRAMEWIDTHRIGHT(4) HEIGHT(95) LEFT(62) LINETYPE(Solid) LINEWIDTH(3) PARENT(#PANEL) TABPOSITION(1) TABSTOP(False) TOP(88) WIDTH(21);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('These details are shown so that you can see what is happening inside the form when radio buttons are selected.') DISPLAYPOSITION(3) HEIGHT(65) LEFT(16) PARENT(#PANEL) TABPOSITION(3) TABSTOP(False) TOP(8) WIDTH(121);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANEL) DISPLAYPOSITION(6) HEIGHT(241) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(6) TABSTOP(False) TOP(128) VISIBLE(False) WIDTH(145);
DEFINE_COM CLASS(#PRIM_TIMR) NAME(#TIMER) INTERVAL(10000);
;
Define #Counter RefFld(#Std_Num) ;
;
EVTROUTINE handling(#com_owner.Initialize);
SET #com_owner caption(*component_desc);
* Dynamically build Sex Group ;
Set #Sex GroupCaption('Sex');
Invoke #Sex.AddRadioButton UseCaption('&Male Student') UseCode(MALE) ;
Invoke #Sex.AddRadioButton UseCaption('&Female Student') UseCode(FEMALE);
Set #Sex CurrentCode(FEMALE);
* Dynamically build Shoe Group ;
Set #Shoe GroupCaption('Shoe Size');
Invoke #Shoe.AddRadioButton UseCaption('Small (S)') UseCode(S) ;
Invoke #Shoe.AddRadioButton UseCaption('Medium (M)') UseCode(M) ;
Invoke #Shoe.AddRadioButton UseCaption('Large (L)') UseCode(L) ;
Invoke #Shoe.AddRadioButton UseCaption('Extra Large (X)') UseCode(X) ;
Set #Shoe CurrentCode(L);
* Dynamically build Tube Cross Section Group ;
Set #Tube GroupCaption('Tube Cross Section');
Invoke #Tube.AddRadioButton UseCaption('&Round') UseCode(R) ;
Invoke #Tube.AddRadioButton UseCaption('&Square') UseCode(S);
Invoke #Tube.AddRadioButton UseCaption('&Triangular') UseCode(T);
Set #Tube CurrentCode(R);
* Dynamically build Employees Group (not a real world example, but shows flexibility of the reusable component ;
Change #Counter 0;
Set #Emp GroupCaption('Employees');
Select (#Empno #SurName) From_File(PSLMST);
Invoke #Emp.AddRadioButton UseCaption(#SurName) UseCode(#Empno) ;
Change #Counter '#Counter + 1';
Leave if('#Counter = 16');
EndSelect;
Set #Emp CurrentCode(#Empno);
ENDROUTINE ;
;
EvtRoutine Handling(#Sex.CodeChanged) NewCode(#NewSex);
Set #SexCode Value(#NewSex.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Shoe.CodeChanged) NewCode(#NewShoe);
Set #ShoeCode Value(#NewShoe.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Tube.CodeChanged) NewCode(#NewTube);
Set #TubeCode Value(#NewTube.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Emp.CodeChanged) NewCode(#NewEmp);
Set #Empno Value(#NewEmp.Value) ;
EndRoutine ;
;
EvtRoutine Handling(#Timer.Tick) ;
if '#Panel.Visible = True';
Set #Panel Visible(False);
else;
Set #Panel Visible(True);
endif ;
EndRoutine ;
;
END_COM ;