Form VL_SAM044: Using Explorer Components to Create an Image Viewer

LANSA

Form VL_SAM044: Using Explorer Components to Create an Image Viewer
Name: VL_SAM044

Description: The following RDMLX form demonstrates how two linked explorer components can be used to create an image viewer.

FUNCTION OPTIONS(*DIRECT);
BEGIN_COM CAPTION('VL_SAM044 - test explorer behaviour') FORMPOSITION(ScreenCenter) HEIGHT(578) LEFT(547) TOP(117) WIDTH(691);
;
* The explorer components - one is a dir tree view the other is a general list view;
;
DEFINE_COM CLASS(#PRIM_DCBX) NAME(#EXPLORE_1) DISPLAYPOSITION(7) FILEINCLUDEMASK('"*.*"') HEIGHT(244) LEFT(18) NOTIFYCOMPONENT(#EXPLORE_2) PARENT(#COM_OWNER) TABPOSITION(1) TABSTOP(False) TOP(26) WIDTH(228);
DEFINE_COM CLASS(#PRIM_DCBX) NAME(#EXPLORE_2) DISPLAYPOSITION(8) DISPLAYSTYLE(GeneralListView) FILEINCLUDEMASK('"*.*"') HEIGHT(245) LEFT(282) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(24) WIDTH(373);
;
* Static graphic dressing;
;
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_1) DISPLAYPOSITION(9) DRAWTYPE(BarSunken) FRAMEHEIGHTBOTTOM(8) FRAMEHEIGHTTOP(8) FRAMEWIDTHLEFT(8) FRAMEWIDTHRIGHT(8) HEIGHT(265) LEFT(272) PARENT(#COM_OWNER) TABPOSITION(4) TOP(16) WIDTH(393);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_2) DISPLAYPOSITION(10) DRAWTYPE(BarSunken) FRAMEHEIGHTBOTTOM(8) FRAMEHEIGHTTOP(8) FRAMEWIDTHLEFT(8) FRAMEWIDTHRIGHT(8) HEIGHT(265) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(5) TOP(16) WIDTH(249);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_3) DISPLAYPOSITION(11) DRAWTYPE(FrameIndentedEdge) HEIGHT(241) LEFT(5) PARENT(#COM_OWNER) TABPOSITION(6) TOP(302) WIDTH(255);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_4) DISPLAYPOSITION(6) DRAWTYPE(BarSunken) HEIGHT(193) LEFT(29) PARENT(#COM_OWNER) TABPOSITION(7) TOP(326) WIDTH(207);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_5) DISPLAYPOSITION(12) DRAWTYPE(FrameIndentedEdge) HEIGHT(153) LEFT(330) PARENT(#COM_OWNER) TABPOSITION(8) TOP(304) WIDTH(177);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_6) DISPLAYPOSITION(5) DRAWTYPE(BarSunken) HEIGHT(123) LEFT(348) PARENT(#COM_OWNER) TABPOSITION(9) TOP(318) WIDTH(142);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_7) DISPLAYPOSITION(13) DRAWTYPE(FrameIndentedEdge) HEIGHT(97) LEFT(559) PARENT(#COM_OWNER) TABPOSITION(10) TOP(304) WIDTH(108);
DEFINE_COM CLASS(#PRIM_STTC) NAME(#STTC_8) DISPLAYPOSITION(4) DRAWTYPE(BarSunken) HEIGHT(65) LEFT(576) PARENT(#COM_OWNER) TABPOSITION(11) TOP(320) WIDTH(73);
;
* Image definitions;
;
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#IMAGE_1) DISPLAYPOSITION(1) HEIGHT(187) LEFT(32) PARENT(#COM_OWNER) TABPOSITION(3) TOP(328) WIDTH(200);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#IMAGE_2) DISPLAYPOSITION(3) HEIGHT(117) LEFT(351) PARENT(#COM_OWNER) TABPOSITION(12) TOP(320) WIDTH(136);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#IMAGE_3) DISPLAYPOSITION(2) HEIGHT(61) LEFT(579) PARENT(#COM_OWNER) TABPOSITION(13) TOP(322) WIDTH(67);
;
* Image pathname label;
;
DEFINE_COM CLASS(#PRIM_LABL) NAME(#FILEINFO) CAPTION('Image Info') DISPLAYPOSITION(14) LEFT(328) PARENT(#COM_OWNER) TABPOSITION(14) TABSTOP(False) TOP(487) WIDTH(339);
;
* Working Storage Fields;
;
DEFINE FIELD(#PATH) TYPE(*CHAR) LENGTH(256) DECIMALS(0);
;
* Set filter on explorer 2 component to only show files of type image ;
;
EvtRoutine handling(#Com_Owner.Initialize);
Set #Explore_2 FileIncludeMask('*.BMP;*.JPG;*.TIF;*.GIF;*.JPEG') ;
EndRoutine ;
;
;
;
EVTROUTINE HANDLING(#EXPLORE_2.ItemGotSelection) Name(#ItemName) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Use builtin(tconcat) with_args(#Explore_2.path #ItemName.value) to_get(#path);
* Display the name of the file;
Set #FileInfo caption(#Path);
* Set up the images;
Set (#Image_1 #Image_2 #Image_3) filename(#Path);
;
ENDROUTINE ;
END_COM ;