S_228FB
* ===================================================================
*
* Component : S_228FB
* Type : Form
* Ancestor : PRIM_FORM
*
* Description : *
* Disclaimer : The following material is supplied as example material
* only. No warranty concerning this material or its use
* in any way whatsoever is expressed or implied.
*
* ===================================================================
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Height(421) Layoutmanager(#SPLM_1) Left(421) Top(162) Visualstyle(#VS_NORM) Width(492)
* The collection of images
Define_Com Class(#PRIM_KCOL) Name(#IMAGE) Reference(*Dynamic) Collects(#PRIM_IMGE) Keyedby(#STD_NUM) Style(Collection)
* Form layout
Define_Com Class(#PRIM_DCBX) Name(#EXPLORER) Displayposition(1) Fileincludemask('"*.*"') Height(394) Left(0) Parent(#LEFT_PANEL) Tabposition(1) Tabstop(False) Top(0) Width(293)
* Define working fields
Define Field(#OV_RETC) Type(*CHAR) Length(2)
Define Field(#OV_ERRN) Type(*DEC) Length(15) Decimals(0)
Define Field(#OV_NAME) Type(*CHAR) Length(80)
Define Field(#OV_PREFIX) Type(*CHAR) Length(80)
Define Field(#OV_SUFFIX) Type(*CHAR) Length(3)
Define Field(#OV_DATE) Type(*CHAR) Length(8)
Define Field(#OV_TIME) Type(*CHAR) Length(6)
Define Field(#OV_ISDIR) Type(*CHAR) Length(1)
Define Field(#OV_SIZE) Type(*DEC) Length(9) Decimals(0) Edit_Code(3)
* Define the working lists
Def_List Name(#IMAG_LIST) Fields(#OV_NAME #OV_PREFIX #OV_SUFFIX #OV_DATE #OV_TIME #OV_SIZE #OV_ISDIR) Type(*WORKING) Entrys(9999)
* Image and position tracking
Define_Com Class(#STD_NUM) Name(#IMAGE_COUNT)
Define_Com Class(#STD_NUM) Name(#USE_PANEL_TOP)
* Form layout details
Define_Com Class(#PRIM_SPLM) Name(#SPLM_1) Orientation(Vertical)
Define_Com Class(#PRIM_PANL) Name(#LEFT_PANEL) Displayposition(1) Height(394) Layoutmanager(#ATLM_1) Left(0) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(0) Width(293)
Define_Com Class(#PRIM_PANL) Name(#RIGHT_PANEL) Displayposition(2) Height(394) Layoutmanager(#ATLM_2) Left(297) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Top(0) Width(187)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_1) Manage(#LEFT_PANEL) Parent(#SPLM_1) Weight(1)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_2) Manage(#RIGHT_PANEL) Parent(#SPLM_1)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_1)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Center) Manage(#EXPLORER) Parent(#ATLM_1)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_2)
Define_Com Class(#PRIM_PANL) Name(#SIZE_PANEL) Displayposition(1) Height(33) Left(0) Parent(#RIGHT_PANEL) Tabposition(1) Tabstop(False) Top(0) Width(187)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_2) Attachment(Top) Manage(#SIZE_PANEL) Parent(#ATLM_2)
Define_Com Class(#PRIM_PANL) Name(#IMAGE_PANEL) Displayposition(2) Height(361) Horizontalscroll(True) Left(0) Parent(#RIGHT_PANEL) Tabposition(2) Tabstop(False) Top(33) Verticalscroll(True) Visible(False) Width(187)
Define_Com Class(#PRIM_SPDT) Name(#USE_HEIGHT) Displayposition(1) Height(22) Left(44) Parent(#SIZE_PANEL) Tabposition(1) Top(5) Width(50)
Define_Com Class(#PRIM_SPDT) Name(#USE_WIDTH) Displayposition(2) Height(22) Left(135) Parent(#SIZE_PANEL) Tabposition(2) Top(4) Value(43) Width(50)
Define_Com Class(#PRIM_LABL) Name(#CAPTION_HEIGHT) Caption('Height') Displayposition(3) Height(20) Left(8) Parent(#SIZE_PANEL) Tabposition(3) Tabstop(False) Top(8) Width(38)
Define_Com Class(#PRIM_LABL) Name(#CAPTION_WIDTH) Caption('Width') Displayposition(4) Height(20) Left(101) Parent(#SIZE_PANEL) Tabposition(4) Tabstop(False) Top(8) Width(35)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_3) Attachment(Center) Manage(#IMAGE_PANEL) Parent(#ATLM_2)
Evtroutine Handling(#Com_Owner.CreateInstance) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
Set Com(#Use_Height #Use_Width) Value(100)
Endroutine
* ===================================================================
* Load images of specified type from a specified directory
* ===================================================================
Mthroutine Name(LoadImages)
Define_Map For(*Input) Class(#std_Texts) Name(#ImageType)
Define_Map For(*Input) Class(#Sysvar$av) Name(#FromDirectory)
Define_com #Prim_Imge #TempImage Reference(*Dynamic)
* Get a list of the specified file types
Clr_List Named(#IMAG_LIST)
Use Builtin(OV_FILE_SERVICE) With_Args(GET_DIR #FROMDIRECTORY.VALUE #IMAGETYPE.VALUE) To_Get(#OV_RETC #OV_ERRN #IMAG_LIST)
* Now create an image for each file found
Selectlist Named(#IMAG_LIST)
Change Field(#STD_NUM) To('#Image_Count.Value + 1')
Set Com(#Image_Count) Value(#Std_Num)
Set_Ref Com(#Image<#Image_Count.Value>) To(*Create_as #PRIM_IMGE)
Set_Ref #TempImage #Image<#Image_Count.Value>
Use Builtin(TCONCAT) With_Args(#FROMDIRECTORY.VALUE '\' #OV_NAME) To_Get(#SYSVAR$AV)
Set #TempImage Parent(#Image_Panel) Filename(#SysVar$av) Left(4) Top(#Use_Panel_Top.Value)
If '(#TempImage.ImageHeight > 0) and (#TempImage.ImageHeight <= #Use_Height.Value) and (#TempImage.ImageWidth > 0) and (#TempImage.ImageWidth <= #Use_Width.Value)'
Set Com(#TempImage) Height(#TempImage.ImageHeight) Width(#TempImage.ImageWidth)
else
Set Com(#TempImage) Height(#Use_Height.Value) Width(#Use_Width.Value)
Endif
Change #Std_Num '#Use_Panel_Top.Value + #TempImage.Height + 4'
Set #Use_Panel_Top Value(#Std_Num)
Endselect
Endroutine
* ===================================================================
* Handle secletion of a directory in the explorer
* ===================================================================
Evtroutine Handling(#Explorer.ItemGotFocus) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
* Hide and destroy all existing images
Set #Image_Panel Visible(False)
Invoke #Com_Owner.UpdateDisplay
Set_Ref Com(#Image) To(*null)
Set Com(#Image_Count) Value(0)
Set Com(#Use_Panel_Top) Value(4)
* Create a new empty image collection
Set_Ref Com(#Image) To(*Create_as #Prim_KCol)
* Now fill the image collection with various types of images
Invoke Method(#Com_Owner.LoadImages) Imagetype(BMP) Fromdirectory(#Explorer.Path)
Invoke Method(#Com_Owner.LoadImages) Imagetype(JPG) Fromdirectory(#Explorer.Path)
Invoke Method(#Com_Owner.LoadImages) Imagetype(GIF) Fromdirectory(#Explorer.Path)
* Realize and display all the images
Invoke Method(#Image_Panel.Realize)
Set #Image_Panel Visible(True)
Endroutine
* ===================================================================
* Handle change of image height to be shown
* ===================================================================
EVTROUTINE HANDLING(#USE_HEIGHT.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS)
Define #LoopLimit Reffld(#Std_Num)
Define #LoopIndex Reffld(#Std_Num)
If_ref #Image is_Not(*null)
If '(#Use_Height.Value > 10) and (#Use_Height.Value < 257)'
Set #Image<> Height(#Use_Height.Value)
Set Com(#Use_Panel_Top) Value(4)
Change #LoopLimit #Image_Count.Value
Begin_Loop from(1) to(#LoopLimit) Using(#LoopIndex)
Set #Image<#LoopIndex> Top(#Use_Panel_Top.Value)
Change #Std_Num '#Use_Panel_Top.Value + #Image<#LoopIndex>.Height + 4'
Set #Use_Panel_Top Value(#Std_Num)
End_Loop
Endif
Endif
ENDROUTINE
* ===================================================================
* handle change of image width to be shown
* ===================================================================
EVTROUTINE HANDLING(#USE_WIDTH.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS)
If_ref #Image is_Not(*null)
If '(#Use_Width.Value > 10) and (#Use_Width.Value < 257)'
Set #Image<> Width(#Use_Width.Value)
Endif
Endif
ENDROUTINE
End_Com
* ===================================================================
*
* Component : S_228FB
* Type : Form
* Ancestor : PRIM_FORM
*
* Description : *
* Disclaimer : The following material is supplied as example material
* only. No warranty concerning this material or its use
* in any way whatsoever is expressed or implied.
*
* ===================================================================
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Height(421) Layoutmanager(#SPLM_1) Left(421) Top(162) Visualstyle(#VS_NORM) Width(492)
* The collection of images
Define_Com Class(#PRIM_KCOL) Name(#IMAGE) Reference(*Dynamic) Collects(#PRIM_IMGE) Keyedby(#STD_NUM) Style(Collection)
* Form layout
Define_Com Class(#PRIM_DCBX) Name(#EXPLORER) Displayposition(1) Fileincludemask('"*.*"') Height(394) Left(0) Parent(#LEFT_PANEL) Tabposition(1) Tabstop(False) Top(0) Width(293)
* Define working fields
Define Field(#OV_RETC) Type(*CHAR) Length(2)
Define Field(#OV_ERRN) Type(*DEC) Length(15) Decimals(0)
Define Field(#OV_NAME) Type(*CHAR) Length(80)
Define Field(#OV_PREFIX) Type(*CHAR) Length(80)
Define Field(#OV_SUFFIX) Type(*CHAR) Length(3)
Define Field(#OV_DATE) Type(*CHAR) Length(8)
Define Field(#OV_TIME) Type(*CHAR) Length(6)
Define Field(#OV_ISDIR) Type(*CHAR) Length(1)
Define Field(#OV_SIZE) Type(*DEC) Length(9) Decimals(0) Edit_Code(3)
* Define the working lists
Def_List Name(#IMAG_LIST) Fields(#OV_NAME #OV_PREFIX #OV_SUFFIX #OV_DATE #OV_TIME #OV_SIZE #OV_ISDIR) Type(*WORKING) Entrys(9999)
* Image and position tracking
Define_Com Class(#STD_NUM) Name(#IMAGE_COUNT)
Define_Com Class(#STD_NUM) Name(#USE_PANEL_TOP)
* Form layout details
Define_Com Class(#PRIM_SPLM) Name(#SPLM_1) Orientation(Vertical)
Define_Com Class(#PRIM_PANL) Name(#LEFT_PANEL) Displayposition(1) Height(394) Layoutmanager(#ATLM_1) Left(0) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(0) Width(293)
Define_Com Class(#PRIM_PANL) Name(#RIGHT_PANEL) Displayposition(2) Height(394) Layoutmanager(#ATLM_2) Left(297) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Top(0) Width(187)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_1) Manage(#LEFT_PANEL) Parent(#SPLM_1) Weight(1)
Define_Com Class(#PRIM_SPLI) Name(#SPLI_2) Manage(#RIGHT_PANEL) Parent(#SPLM_1)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_1)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Center) Manage(#EXPLORER) Parent(#ATLM_1)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_2)
Define_Com Class(#PRIM_PANL) Name(#SIZE_PANEL) Displayposition(1) Height(33) Left(0) Parent(#RIGHT_PANEL) Tabposition(1) Tabstop(False) Top(0) Width(187)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_2) Attachment(Top) Manage(#SIZE_PANEL) Parent(#ATLM_2)
Define_Com Class(#PRIM_PANL) Name(#IMAGE_PANEL) Displayposition(2) Height(361) Horizontalscroll(True) Left(0) Parent(#RIGHT_PANEL) Tabposition(2) Tabstop(False) Top(33) Verticalscroll(True) Visible(False) Width(187)
Define_Com Class(#PRIM_SPDT) Name(#USE_HEIGHT) Displayposition(1) Height(22) Left(44) Parent(#SIZE_PANEL) Tabposition(1) Top(5) Width(50)
Define_Com Class(#PRIM_SPDT) Name(#USE_WIDTH) Displayposition(2) Height(22) Left(135) Parent(#SIZE_PANEL) Tabposition(2) Top(4) Value(43) Width(50)
Define_Com Class(#PRIM_LABL) Name(#CAPTION_HEIGHT) Caption('Height') Displayposition(3) Height(20) Left(8) Parent(#SIZE_PANEL) Tabposition(3) Tabstop(False) Top(8) Width(38)
Define_Com Class(#PRIM_LABL) Name(#CAPTION_WIDTH) Caption('Width') Displayposition(4) Height(20) Left(101) Parent(#SIZE_PANEL) Tabposition(4) Tabstop(False) Top(8) Width(35)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_3) Attachment(Center) Manage(#IMAGE_PANEL) Parent(#ATLM_2)
Evtroutine Handling(#Com_Owner.CreateInstance) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
Set Com(#Use_Height #Use_Width) Value(100)
Endroutine
* ===================================================================
* Load images of specified type from a specified directory
* ===================================================================
Mthroutine Name(LoadImages)
Define_Map For(*Input) Class(#std_Texts) Name(#ImageType)
Define_Map For(*Input) Class(#Sysvar$av) Name(#FromDirectory)
Define_com #Prim_Imge #TempImage Reference(*Dynamic)
* Get a list of the specified file types
Clr_List Named(#IMAG_LIST)
Use Builtin(OV_FILE_SERVICE) With_Args(GET_DIR #FROMDIRECTORY.VALUE #IMAGETYPE.VALUE) To_Get(#OV_RETC #OV_ERRN #IMAG_LIST)
* Now create an image for each file found
Selectlist Named(#IMAG_LIST)
Change Field(#STD_NUM) To('#Image_Count.Value + 1')
Set Com(#Image_Count) Value(#Std_Num)
Set_Ref Com(#Image<#Image_Count.Value>) To(*Create_as #PRIM_IMGE)
Set_Ref #TempImage #Image<#Image_Count.Value>
Use Builtin(TCONCAT) With_Args(#FROMDIRECTORY.VALUE '\' #OV_NAME) To_Get(#SYSVAR$AV)
Set #TempImage Parent(#Image_Panel) Filename(#SysVar$av) Left(4) Top(#Use_Panel_Top.Value)
If '(#TempImage.ImageHeight > 0) and (#TempImage.ImageHeight <= #Use_Height.Value) and (#TempImage.ImageWidth > 0) and (#TempImage.ImageWidth <= #Use_Width.Value)'
Set Com(#TempImage) Height(#TempImage.ImageHeight) Width(#TempImage.ImageWidth)
else
Set Com(#TempImage) Height(#Use_Height.Value) Width(#Use_Width.Value)
Endif
Change #Std_Num '#Use_Panel_Top.Value + #TempImage.Height + 4'
Set #Use_Panel_Top Value(#Std_Num)
Endselect
Endroutine
* ===================================================================
* Handle secletion of a directory in the explorer
* ===================================================================
Evtroutine Handling(#Explorer.ItemGotFocus) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
* Hide and destroy all existing images
Set #Image_Panel Visible(False)
Invoke #Com_Owner.UpdateDisplay
Set_Ref Com(#Image) To(*null)
Set Com(#Image_Count) Value(0)
Set Com(#Use_Panel_Top) Value(4)
* Create a new empty image collection
Set_Ref Com(#Image) To(*Create_as #Prim_KCol)
* Now fill the image collection with various types of images
Invoke Method(#Com_Owner.LoadImages) Imagetype(BMP) Fromdirectory(#Explorer.Path)
Invoke Method(#Com_Owner.LoadImages) Imagetype(JPG) Fromdirectory(#Explorer.Path)
Invoke Method(#Com_Owner.LoadImages) Imagetype(GIF) Fromdirectory(#Explorer.Path)
* Realize and display all the images
Invoke Method(#Image_Panel.Realize)
Set #Image_Panel Visible(True)
Endroutine
* ===================================================================
* Handle change of image height to be shown
* ===================================================================
EVTROUTINE HANDLING(#USE_HEIGHT.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS)
Define #LoopLimit Reffld(#Std_Num)
Define #LoopIndex Reffld(#Std_Num)
If_ref #Image is_Not(*null)
If '(#Use_Height.Value > 10) and (#Use_Height.Value < 257)'
Set #Image<> Height(#Use_Height.Value)
Set Com(#Use_Panel_Top) Value(4)
Change #LoopLimit #Image_Count.Value
Begin_Loop from(1) to(#LoopLimit) Using(#LoopIndex)
Set #Image<#LoopIndex> Top(#Use_Panel_Top.Value)
Change #Std_Num '#Use_Panel_Top.Value + #Image<#LoopIndex>.Height + 4'
Set #Use_Panel_Top Value(#Std_Num)
End_Loop
Endif
Endif
ENDROUTINE
* ===================================================================
* handle change of image width to be shown
* ===================================================================
EVTROUTINE HANDLING(#USE_WIDTH.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS)
If_ref #Image is_Not(*null)
If '(#Use_Width.Value > 10) and (#Use_Width.Value < 257)'
Set #Image<> Width(#Use_Width.Value)
Endif
Endif
ENDROUTINE
End_Com