Form VL_SAM111: World Map
Name: VL_SAM111
Description: The following RDMLX form demonstrates how a bitmap of the world can be used to present and manage selectable bitmap location details.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM FORMPOSITION(ScreenCenter) HEIGHT(388) LAYOUTMANAGER(#ATLM_1) VISUALSTYLE(#VS_NORM) WIDTH(645);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_1);
DEFINE_COM CLASS(#PRIM_STBR) NAME(#STATUSBAR) DISPLAYPOSITION(1) HEIGHT(26) LAYOUTSTYLE(Flow) LEFT(0) MESSAGEPOSITION(1) PARENT(#COM_OWNER) TABPOSITION(1) TABSTOP(False) TOP(335) VISUALSTYLEOFPARENT(False) WIDTH(637);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_2) DISPLAYPOSITION(1) HEIGHT(31) LAYOUTMANAGER(#ATLM_4) LEFT(0) PARENT(#IMAGEPANEL) TABPOSITION(2) TABSTOP(False) TOP(304) VISIBLE(False) WIDTH(507);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_1) ATTACHMENT(Bottom) MANAGE(#STATUSBAR) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_2) ATTACHMENT(Center) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_8) ATTACHMENT(Bottom) MANAGE(#GPBX_2) PARENT(#ATLM_1);
;
DEFINE_COM CLASS(#PRIM_KCOL) NAME(#LOCATION) COLLECTS(#VL_SAM110) KEYEDBY(#STD_CODEL);
DEFINE_COM CLASS(#PRIM_TIMR) NAME(#TIMER) INTERVAL(0);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#IMAGEPANEL) DISPLAYPOSITION(2) HEIGHT(335) LAYOUTMANAGER(#ATLM_2) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(0) WIDTH(507);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_3) ATTACHMENT(Center) MANAGE(#IMAGEPANEL) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_2);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#IMAGE) DISPLAYPOSITION(2) HEIGHT(304) LEFT(0) PARENT(#IMAGEPANEL) TABPOSITION(1) TOP(0) WIDTH(481);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_4) ATTACHMENT(Center) MANAGE(#IMAGE) PARENT(#ATLM_2);
DEFINE_COM CLASS(#STD_TEXTL.Visual) NAME(#MESSAGELINE) DISPLAYPOSITION(1) HEIGHT(20) LEFT(7) MARGINLEFT(0) PARENT(#STATUSBAR) READONLY(True) TABPOSITION(1) TABSTOP(False) TOP(4) VISUALSTYLE(#VS_NOREAD) WIDTH(399);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#CONTROL) DISPLAYPOSITION(3) HEIGHT(304) LAYOUTMANAGER(#ATLM_3) LEFT(481) PARENT(#IMAGEPANEL) TABPOSITION(3) TABSTOP(False) TOP(0) VISIBLE(False) WIDTH(26);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_5) ATTACHMENT(Right) MANAGE(#CONTROL) PARENT(#ATLM_1);
;
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_3);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#TRACK_VER) DISPLAYPOSITION(1) ENABLED(False) HEIGHT(289) LEFT(4) ORIENTATION(Vertical) PARENT(#CONTROL) TABPOSITION(1) TICKSTYLE(Manual) TOP(11) VALUE(1) WIDTH(18);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_6) ATTACHMENT(Center) MANAGE(#TRACK_VER) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) DISPLAYPOSITION(3) HEIGHT(335) LEFT(507) PARENT(#COM_OWNER) TABPOSITION(3) TABSTOP(False) TOP(0) VISIBLE(False) WIDTH(130);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_7) ATTACHMENT(Right) MANAGE(#GPBX_1) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_4);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_9) ATTACHMENT(Bottom) MANAGE(#GPBX_2) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_10) ATTACHMENT(Right) MANAGE(#CONTROL) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#TRACK_HOR) DISPLAYPOSITION(1) ENABLED(False) HEIGHT(16) LEFT(4) PARENT(#GPBX_2) TABPOSITION(1) TICKSTYLE(Manual) TOP(11) VALUE(1) WIDTH(484);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_11) ATTACHMENT(Center) MANAGE(#TRACK_HOR) PARENT(#ATLM_4);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_1) DISPLAYPOSITION(2) HEIGHT(16) LEFT(488) PARENT(#GPBX_2) TABPOSITION(2) TABSTOP(False) TOP(11) WIDTH(15);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_12) ATTACHMENT(Right) MANAGE(#PANL_1) PARENT(#ATLM_4);
;
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#CURRENTLOCATION) CAPTION('Code') DISPLAYPOSITION(1) HEIGHT(38) LABELPOSITION(Top) LABELTYPE(Caption) LEFT(8) MARGINLEFT(0) MARGINTOP(19) PARENT(#GPBX_1) TABPOSITION(1) TOP(8) WIDTH(57);
DEFINE_COM CLASS(#STD_TEXTL.Visual) NAME(#CURRENTHINT) CAPTION('Hint') DISPLAYPOSITION(2) HEIGHT(38) LABELPOSITION(Top) LABELTYPE(Caption) LEFT(8) MARGINLEFT(0) MARGINTOP(19) PARENT(#GPBX_1) TABPOSITION(2) TOP(45) WIDTH(113);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_NEW) CAPTION('New Location') DISPLAYPOSITION(3) ENABLED(False) LEFT(8) PARENT(#GPBX_1) TABPOSITION(3) TOP(90) WIDTH(113);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#LOC_SIZES) CAPTION('Display Size') DISPLAYPOSITION(4) HEIGHT(105) LEFT(8) PARENT(#GPBX_1) TABPOSITION(5) TABSTOP(False) TOP(144) WIDTH(113);
DEFINE_COM CLASS(#PRIM_CKBX) NAME(#ALL_LOCATIONS) CAPTION('All Locations') DISPLAYPOSITION(1) HEIGHT(11) LEFT(8) PARENT(#LOC_SIZES) TABPOSITION(1) TOP(16) WIDTH(89);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#LOC_HEIGHT) DISPLAYPOSITION(3) HEIGHT(19) LEFT(5) MINIMUMVALUE(2) PARENT(#LOC_SIZES) TABPOSITION(2) TICKSTYLE(None) TOP(32) VALUE(6) WIDTH(57);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('Height') DISPLAYPOSITION(5) HEIGHT(17) LEFT(64) PARENT(#LOC_SIZES) TABPOSITION(5) TABSTOP(False) TOP(32) WIDTH(37);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#LOC_WIDTH) DISPLAYPOSITION(2) HEIGHT(19) LEFT(5) MINIMUMVALUE(2) PARENT(#LOC_SIZES) TABPOSITION(3) TICKSTYLE(None) TOP(48) VALUE(6) WIDTH(57);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_2) CAPTION('Width') DISPLAYPOSITION(4) HEIGHT(17) LEFT(64) PARENT(#LOC_SIZES) TABPOSITION(4) TABSTOP(False) TOP(48) WIDTH(37);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_DELETE) CAPTION('Delete Location') DISPLAYPOSITION(5) ENABLED(False) LEFT(8) PARENT(#GPBX_1) TABPOSITION(4) TOP(117) WIDTH(113);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_RESET) CAPTION('Default Size') DISPLAYPOSITION(6) LEFT(9) PARENT(#LOC_SIZES) TABPOSITION(6) TOP(72) WIDTH(93);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_EDIT) CAPTION('Edit') DISPLAYPOSITION(2) HEIGHT(20) LEFT(408) PARENT(#STATUSBAR) TABPOSITION(2) TOP(4) WIDTH(70);
;
Define #UHeight RefFld(#std_Num);
Define #UWidth RefFld(#std_Num);
Define #Save_File *Char 100 ;
Define #BRetCode *Char 2;
;
* Form Instance Creation;
;
EVTROUTINE handling(#com_owner.CreateInstance) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
* Set the bitmap to be vl_sam104.bmp from the partition source directory ;
;
Use TConcat (*Part_Dir_Source Vl_sam104.bmp) (#SysVar$Av);
Set #Image FileName(#SysVar$Av);
;
* Set up the save file name ;
;
Use TConcat (*Temp_Dir *Component '.dat') (#Save_File);
;
* Alter the form height and width details to match the image details;
;
Change #UHeight '#Image.ImageHeight + #GPBX_2.Height + #StatusBar.Height + 22';
Change #UWidth '#Image.ImageWidth + #Control.Width + #GPBX_1.Width';
Set #Com_Owner Height(#UHeight) Width(#UWidth) caption(*component_desc);
;
ENDROUTINE;
;
* Handle Form Initialization;
;
EVTROUTINE handling(#com_owner.Initialize) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
* Restore location details onto the world bitmap;
;
Invoke #Com_Owner.RestoreLocations;
;
* Start the timer that will look for changes in size of the image ;
;
Set #timer Interval(100);
;
EndRoutine;
;
* Handle Form Closing ;
;
EVTROUTINE handling(#Com_owner.Closing) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
* Save all location details into a disk file in the temp directory;
;
Clr_List #Loc_List ;
Change #Loc_Save Y;
Invoke #Location<>.EnumerateExistence;
Use Transform_List (#Loc_List #Save_File T) (#BRetCode);
;
ENDROUTINE;
;
* Timer has ticked ;
;
EvtRoutine Handling(#Timer.Tick) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Define #LHeight RefFld(#std_Num);
Define #LWidth RefFld(#std_Num);
;
* If the image shape has changed, tell all location components;
* to show themselves in the new computed locations ;
;
If '(#LHeight *ne #Image.Height) or (#LWidth *ne #Image.Width)';
;
Change #LHeight #Image.Height;
Change #LWidth #Image.Width;
;
Set #location<> Mapheight(#LHeight) MapWidth(#LWidth);
Invoke #location<>.Show;
;
Endif;
;
EndRoutine;
;
* Handle a location telling us that it was selected by the user ;
;
EvtRoutine Handling(#Location<>.LocationSelected) SelectedId(#LocID) SelectedHint(#LocHint) Com_Sender(#Sender) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Set #Btn_New Enabled(False);
Set #Btn_Delete Enabled(True);
;
Invoke #Location<>.DeSelect;
;
Set #Loc_Height Value(#Sender.LocationHeight);
Set #Loc_Width Value(#Sender.LocationWidth);
;
Set #CurrentLocation Value(#LocID.Value);
Set #CurrentHint Value(#LocHint.Value) ;
;
;
Use BConcat (#LocHint.Value '(' #LocId.Value ') selected') (#SysVar$av) ;
Set #MessageLine Value(#SysVar$av);
;
Set #Track_Ver MinimumValue(0) MaximumValue(#Image.ImageHeight) Value(#Location<#CurrentLocation>.LocationY) Enabled(True);
Set #Track_Hor MinimumValue(0) MaximumValue(#Image.ImageWidth) Value(#Location<#CurrentLocation>.LocationX) Enabled(True);
;
EndRoutine;
;
* Handle change in vertical location position track bar value;
;
EVTROUTINE HANDLING(#TRACK_VER.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation> LocationY(#Track_Ver.Value) ;
Invoke #location<#CurrentLocation>.Show;
Endif;
ENDROUTINE;
;
* Handle change in horizontal location position track bar value;
;
EVTROUTINE HANDLING(#TRACK_Hor.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation> LocationX(#Track_Hor.Value) ;
Invoke #location<#CurrentLocation>.Show;
Endif;
ENDROUTINE;
;
* Handle input to location Id;
;
EVTROUTINE HANDLING(#CurrentLocation.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Change (#Loc_Exist #Loc_Save) N;
;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
;
If '(#Loc_Exist = N) *and (#CurrentLocation.Value *ne *blanks)';
Set #Btn_New Enabled(True);
Set #Btn_Delete Enabled(False);
Else;
if '#CurrentLocation.Value *ne *blanks';
Invoke #Location<#CurrentLocation>.Select;
Endif;
Endif;
;
ENDROUTINE;
;
* Handle input to location hint. If current location exists, update its hint immediately;
;
EVTROUTINE HANDLING(#CurrentHint.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Change (#Loc_Exist #Loc_Save) N;
;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
;
If '(#Loc_Exist = Y) *and (#CurrentHint.Value *ne *Blanks)';
Set #Location<#CurrentLocation> LocationHint(#CurrentHint);
Endif;
;
EndRoutine;
;
* Handle the delete button;
;
EVTROUTINE HANDLING(#Btn_Delete.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change (#Loc_Exist #Loc_Save) N;
;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
;
If '#Loc_Exist = Y';
Invoke #Location<#CurrentLocation>.DeSelect;
Set #Location<#CurrentLocation> Active(N);
Invoke #Location<#CurrentLocation>.Show;
Set (#CurrentLocation #CurrentHint) Value(' ');
Set (#Btn_New #Btn_Delete) Enabled(False);
Endif;
;
EndRoutine;
;
;
* Handle a location signalling its existence back to us. Two modes are ;
* supported. First is simply to verify whether the location exists,;
* second is to handle creation of a working list of all locations. ;
;
;
EvtRoutine Handling(#Location<>.LocationExists) Com_Sender(#sender);
;
Define #Loc_Exist RefFld(#Std_CodeS) ;
Define #Loc_Save RefFld(#Std_CodeS) ;
;
Define #Save_Id RefFld(#Std_CodeL);
Define #Save_Hint RefFld(#Std_TextL);
Define #Save_LocX RefFld(#Std_Num);
Define #Save_LocY RefFld(#Std_Num);
Define #Save_Hgt RefFld(#Std_Num);
Define #Save_Wid RefFld(#Std_Num);
;
Def_List #Loc_List (#Save_Id #Save_Hint #Save_Locx #Save_LocY #Save_Hgt #Save_Wid) type(*working) entrys(9999);
;
Change #Loc_Exist Y;
;
If '#Loc_Save = Y';
Change #Save_Id #Sender.LocationId ;
Change #Save_Hint #Sender.LocationHint ;
Change #Save_LocX #Sender.LocationX ;
Change #Save_LocY #Sender.LocationY ;
Change #Save_Hgt #Sender.LocationHeight;
Change #Save_Wid #Sender.LocationWidth ;
Add_Entry #Loc_List;
Endif;
;
EndRoutine;
;
* Handle the New Location push button ;
;
EVTROUTINE HANDLING(#BTN_NEW.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Set #Location<#CurrentLocation> Active(Y) Locationid(#CurrentLocation) LocationHint(#CurrentHint) LocationX(1) LocationY(1) Mapheight(#Image.Height) MapWidth(#Image.Width) Parent(#ImagePanel) MaximumXValue(#Image.ImageWidth) MaximumYValue(#Image.ImageHeight) ScaleHeight(#Image.ImageHeight) ScaleWidth(#Image.ImageWidth) LocationHeight(#Loc_Height.Value) LocationWidth(#Loc_Width.Value);
Invoke #Location<#CurrentLocation>.Show;
Invoke #Location<#CurrentLocation>.Select;
ENDROUTINE;
;
* Handle Location Height changed for current or all locations;
;
EVTROUTINE HANDLING(#Loc_Height.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
if '#All_Locations.ButtonState = Checked';
Set #Location<> LocationHeight(#Loc_Height.Value);
Else;
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation.Value> LocationHeight(#Loc_Height.Value);
Endif;
Endif;
ENDROUTINE;
;
* Handle Location Width changed for current or all locations;
;
EVTROUTINE HANDLING(#Loc_Width.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
if '#All_Locations.ButtonState = Checked';
Set #Location<> LocationWidth(#Loc_Width.Value);
Else;
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation.Value> LocationWidth(#Loc_Width.Value);
Endif;
Endif;
ENDROUTINE;
;
* Handle size reset button usage;
;
EVTROUTINE HANDLING(#Btn_Reset.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Set (#Loc_Height #Loc_Width) Value(6);
if '#All_Locations.ButtonState = Checked';
Set #Location<> LocationWidth(6) LocationHeight(6);
Else;
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation.Value> LocationWidth(6) LocationHeight(6);
Endif;
Endif;
ENDROUTINE;
;
* Restore previously saved locations from disk file, or create default set of locations;
;
;
MthRoutine RestoreLocations;
;
Use Transform_File (#Loc_List #Save_File T) (#BRetCode);
;
* If file data found, use it's data to create location instances;
;
If '#BRetCode *ne ER';
;
SelectList #Loc_List;
Set #location<#Save_Id> Locationid(#Save_Id) LocationHint(#Save_Hint) LocationX(#Save_LocX) LocationY(#Save_LocY) LocationHeight(#Save_Hgt) LocationWidth(#Save_Wid);
EndSelect;
;
* Else .... create default data by hard code ;
;
Else;
Use Clr_Messages;
Set #location<SYD> Locationid(SYD) LocationHint('Sydney, Australia') LocationX(370) locationy(196);
Set #location<LON> Locationid(LON) LocationHint('London, England') LocationX(182) locationy(67);
Set #location<NYK> Locationid(NYK) LocationHint('New York, USA') LocationX(88) locationy(85);
Set #location<CHG> Locationid(CHG) LocationHint('Chicago, USA') LocationX(70) locationy(82);
Set #location<TOK> Locationid(TOK) LocationHint('Tokyo, Japan') LocationX(355) locationy(92);
Set #location<JBG> Locationid(JBG) LocationHint('Johannesberg, South Africa') LocationX(218) locationy(183);
Set #location<ROM> Locationid(ROM) LocationHint('Rome, Italy') LocationX(200) locationy(83);
Set #location<PAR> Locationid(PAR) LocationHint('Paris, France') LocationX(187) locationy(72);
Set #location<BEJ> Locationid(BEJ) LocationHint('Bejing, China') LocationX(336) locationy(77);
Set #location<TOR> Locationid(TOR) LocationHint('Toronto, Canada') LocationX(84) locationy(76);
Endif;
;
* Tell ALL the location components created about the scaling system ;
* being utilized. In this case we are using a scaling system based;
* on the pixel locations on the bitmap (view the bitmap with MS-Paint;
* to see why the values used were used). So the scaling system is ;
* exactly the same as the height and width of the image (top left;
* is 0,0). ;
;
Set #Location<> Parent(#ImagePanel) MaximumXValue(#Image.ImageWidth) MaximumYValue(#Image.ImageHeight) ScaleHeight(#Image.ImageHeight) ScaleWidth(#Image.ImageWidth);
;
EndRoutine;
;
* Handle Edit / View modes of display ;
;
EVTROUTINE HANDLING(#BTN_EDIT.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
If '#Btn_Edit.Caption = ''Edit''';
Set #Btn_Edit caption('View');
Set (#GpBX_1 #GpBx_2 #Control) Visible(True) ;
Else;
Set #Btn_Edit caption('Edit') ;
Set (#GpBX_1 #GpBx_2 #Control) Visible(False) ;
Endif;
;
ENDROUTINE;
;
END_COM;
Name: VL_SAM111
Description: The following RDMLX form demonstrates how a bitmap of the world can be used to present and manage selectable bitmap location details.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM FORMPOSITION(ScreenCenter) HEIGHT(388) LAYOUTMANAGER(#ATLM_1) VISUALSTYLE(#VS_NORM) WIDTH(645);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_1);
DEFINE_COM CLASS(#PRIM_STBR) NAME(#STATUSBAR) DISPLAYPOSITION(1) HEIGHT(26) LAYOUTSTYLE(Flow) LEFT(0) MESSAGEPOSITION(1) PARENT(#COM_OWNER) TABPOSITION(1) TABSTOP(False) TOP(335) VISUALSTYLEOFPARENT(False) WIDTH(637);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_2) DISPLAYPOSITION(1) HEIGHT(31) LAYOUTMANAGER(#ATLM_4) LEFT(0) PARENT(#IMAGEPANEL) TABPOSITION(2) TABSTOP(False) TOP(304) VISIBLE(False) WIDTH(507);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_1) ATTACHMENT(Bottom) MANAGE(#STATUSBAR) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_2) ATTACHMENT(Center) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_8) ATTACHMENT(Bottom) MANAGE(#GPBX_2) PARENT(#ATLM_1);
;
DEFINE_COM CLASS(#PRIM_KCOL) NAME(#LOCATION) COLLECTS(#VL_SAM110) KEYEDBY(#STD_CODEL);
DEFINE_COM CLASS(#PRIM_TIMR) NAME(#TIMER) INTERVAL(0);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#IMAGEPANEL) DISPLAYPOSITION(2) HEIGHT(335) LAYOUTMANAGER(#ATLM_2) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(0) WIDTH(507);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_3) ATTACHMENT(Center) MANAGE(#IMAGEPANEL) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_2);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#IMAGE) DISPLAYPOSITION(2) HEIGHT(304) LEFT(0) PARENT(#IMAGEPANEL) TABPOSITION(1) TOP(0) WIDTH(481);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_4) ATTACHMENT(Center) MANAGE(#IMAGE) PARENT(#ATLM_2);
DEFINE_COM CLASS(#STD_TEXTL.Visual) NAME(#MESSAGELINE) DISPLAYPOSITION(1) HEIGHT(20) LEFT(7) MARGINLEFT(0) PARENT(#STATUSBAR) READONLY(True) TABPOSITION(1) TABSTOP(False) TOP(4) VISUALSTYLE(#VS_NOREAD) WIDTH(399);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#CONTROL) DISPLAYPOSITION(3) HEIGHT(304) LAYOUTMANAGER(#ATLM_3) LEFT(481) PARENT(#IMAGEPANEL) TABPOSITION(3) TABSTOP(False) TOP(0) VISIBLE(False) WIDTH(26);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_5) ATTACHMENT(Right) MANAGE(#CONTROL) PARENT(#ATLM_1);
;
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_3);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#TRACK_VER) DISPLAYPOSITION(1) ENABLED(False) HEIGHT(289) LEFT(4) ORIENTATION(Vertical) PARENT(#CONTROL) TABPOSITION(1) TICKSTYLE(Manual) TOP(11) VALUE(1) WIDTH(18);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_6) ATTACHMENT(Center) MANAGE(#TRACK_VER) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) DISPLAYPOSITION(3) HEIGHT(335) LEFT(507) PARENT(#COM_OWNER) TABPOSITION(3) TABSTOP(False) TOP(0) VISIBLE(False) WIDTH(130);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_7) ATTACHMENT(Right) MANAGE(#GPBX_1) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_4);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_9) ATTACHMENT(Bottom) MANAGE(#GPBX_2) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_10) ATTACHMENT(Right) MANAGE(#CONTROL) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#TRACK_HOR) DISPLAYPOSITION(1) ENABLED(False) HEIGHT(16) LEFT(4) PARENT(#GPBX_2) TABPOSITION(1) TICKSTYLE(Manual) TOP(11) VALUE(1) WIDTH(484);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_11) ATTACHMENT(Center) MANAGE(#TRACK_HOR) PARENT(#ATLM_4);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_1) DISPLAYPOSITION(2) HEIGHT(16) LEFT(488) PARENT(#GPBX_2) TABPOSITION(2) TABSTOP(False) TOP(11) WIDTH(15);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_12) ATTACHMENT(Right) MANAGE(#PANL_1) PARENT(#ATLM_4);
;
DEFINE_COM CLASS(#STD_CODEL.Visual) NAME(#CURRENTLOCATION) CAPTION('Code') DISPLAYPOSITION(1) HEIGHT(38) LABELPOSITION(Top) LABELTYPE(Caption) LEFT(8) MARGINLEFT(0) MARGINTOP(19) PARENT(#GPBX_1) TABPOSITION(1) TOP(8) WIDTH(57);
DEFINE_COM CLASS(#STD_TEXTL.Visual) NAME(#CURRENTHINT) CAPTION('Hint') DISPLAYPOSITION(2) HEIGHT(38) LABELPOSITION(Top) LABELTYPE(Caption) LEFT(8) MARGINLEFT(0) MARGINTOP(19) PARENT(#GPBX_1) TABPOSITION(2) TOP(45) WIDTH(113);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_NEW) CAPTION('New Location') DISPLAYPOSITION(3) ENABLED(False) LEFT(8) PARENT(#GPBX_1) TABPOSITION(3) TOP(90) WIDTH(113);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#LOC_SIZES) CAPTION('Display Size') DISPLAYPOSITION(4) HEIGHT(105) LEFT(8) PARENT(#GPBX_1) TABPOSITION(5) TABSTOP(False) TOP(144) WIDTH(113);
DEFINE_COM CLASS(#PRIM_CKBX) NAME(#ALL_LOCATIONS) CAPTION('All Locations') DISPLAYPOSITION(1) HEIGHT(11) LEFT(8) PARENT(#LOC_SIZES) TABPOSITION(1) TOP(16) WIDTH(89);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#LOC_HEIGHT) DISPLAYPOSITION(3) HEIGHT(19) LEFT(5) MINIMUMVALUE(2) PARENT(#LOC_SIZES) TABPOSITION(2) TICKSTYLE(None) TOP(32) VALUE(6) WIDTH(57);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('Height') DISPLAYPOSITION(5) HEIGHT(17) LEFT(64) PARENT(#LOC_SIZES) TABPOSITION(5) TABSTOP(False) TOP(32) WIDTH(37);
DEFINE_COM CLASS(#PRIM_TKBR) NAME(#LOC_WIDTH) DISPLAYPOSITION(2) HEIGHT(19) LEFT(5) MINIMUMVALUE(2) PARENT(#LOC_SIZES) TABPOSITION(3) TICKSTYLE(None) TOP(48) VALUE(6) WIDTH(57);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_2) CAPTION('Width') DISPLAYPOSITION(4) HEIGHT(17) LEFT(64) PARENT(#LOC_SIZES) TABPOSITION(4) TABSTOP(False) TOP(48) WIDTH(37);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_DELETE) CAPTION('Delete Location') DISPLAYPOSITION(5) ENABLED(False) LEFT(8) PARENT(#GPBX_1) TABPOSITION(4) TOP(117) WIDTH(113);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_RESET) CAPTION('Default Size') DISPLAYPOSITION(6) LEFT(9) PARENT(#LOC_SIZES) TABPOSITION(6) TOP(72) WIDTH(93);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_EDIT) CAPTION('Edit') DISPLAYPOSITION(2) HEIGHT(20) LEFT(408) PARENT(#STATUSBAR) TABPOSITION(2) TOP(4) WIDTH(70);
;
Define #UHeight RefFld(#std_Num);
Define #UWidth RefFld(#std_Num);
Define #Save_File *Char 100 ;
Define #BRetCode *Char 2;
;
* Form Instance Creation;
;
EVTROUTINE handling(#com_owner.CreateInstance) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
* Set the bitmap to be vl_sam104.bmp from the partition source directory ;
;
Use TConcat (*Part_Dir_Source Vl_sam104.bmp) (#SysVar$Av);
Set #Image FileName(#SysVar$Av);
;
* Set up the save file name ;
;
Use TConcat (*Temp_Dir *Component '.dat') (#Save_File);
;
* Alter the form height and width details to match the image details;
;
Change #UHeight '#Image.ImageHeight + #GPBX_2.Height + #StatusBar.Height + 22';
Change #UWidth '#Image.ImageWidth + #Control.Width + #GPBX_1.Width';
Set #Com_Owner Height(#UHeight) Width(#UWidth) caption(*component_desc);
;
ENDROUTINE;
;
* Handle Form Initialization;
;
EVTROUTINE handling(#com_owner.Initialize) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
* Restore location details onto the world bitmap;
;
Invoke #Com_Owner.RestoreLocations;
;
* Start the timer that will look for changes in size of the image ;
;
Set #timer Interval(100);
;
EndRoutine;
;
* Handle Form Closing ;
;
EVTROUTINE handling(#Com_owner.Closing) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
* Save all location details into a disk file in the temp directory;
;
Clr_List #Loc_List ;
Change #Loc_Save Y;
Invoke #Location<>.EnumerateExistence;
Use Transform_List (#Loc_List #Save_File T) (#BRetCode);
;
ENDROUTINE;
;
* Timer has ticked ;
;
EvtRoutine Handling(#Timer.Tick) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Define #LHeight RefFld(#std_Num);
Define #LWidth RefFld(#std_Num);
;
* If the image shape has changed, tell all location components;
* to show themselves in the new computed locations ;
;
If '(#LHeight *ne #Image.Height) or (#LWidth *ne #Image.Width)';
;
Change #LHeight #Image.Height;
Change #LWidth #Image.Width;
;
Set #location<> Mapheight(#LHeight) MapWidth(#LWidth);
Invoke #location<>.Show;
;
Endif;
;
EndRoutine;
;
* Handle a location telling us that it was selected by the user ;
;
EvtRoutine Handling(#Location<>.LocationSelected) SelectedId(#LocID) SelectedHint(#LocHint) Com_Sender(#Sender) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Set #Btn_New Enabled(False);
Set #Btn_Delete Enabled(True);
;
Invoke #Location<>.DeSelect;
;
Set #Loc_Height Value(#Sender.LocationHeight);
Set #Loc_Width Value(#Sender.LocationWidth);
;
Set #CurrentLocation Value(#LocID.Value);
Set #CurrentHint Value(#LocHint.Value) ;
;
;
Use BConcat (#LocHint.Value '(' #LocId.Value ') selected') (#SysVar$av) ;
Set #MessageLine Value(#SysVar$av);
;
Set #Track_Ver MinimumValue(0) MaximumValue(#Image.ImageHeight) Value(#Location<#CurrentLocation>.LocationY) Enabled(True);
Set #Track_Hor MinimumValue(0) MaximumValue(#Image.ImageWidth) Value(#Location<#CurrentLocation>.LocationX) Enabled(True);
;
EndRoutine;
;
* Handle change in vertical location position track bar value;
;
EVTROUTINE HANDLING(#TRACK_VER.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation> LocationY(#Track_Ver.Value) ;
Invoke #location<#CurrentLocation>.Show;
Endif;
ENDROUTINE;
;
* Handle change in horizontal location position track bar value;
;
EVTROUTINE HANDLING(#TRACK_Hor.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation> LocationX(#Track_Hor.Value) ;
Invoke #location<#CurrentLocation>.Show;
Endif;
ENDROUTINE;
;
* Handle input to location Id;
;
EVTROUTINE HANDLING(#CurrentLocation.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Change (#Loc_Exist #Loc_Save) N;
;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
;
If '(#Loc_Exist = N) *and (#CurrentLocation.Value *ne *blanks)';
Set #Btn_New Enabled(True);
Set #Btn_Delete Enabled(False);
Else;
if '#CurrentLocation.Value *ne *blanks';
Invoke #Location<#CurrentLocation>.Select;
Endif;
Endif;
;
ENDROUTINE;
;
* Handle input to location hint. If current location exists, update its hint immediately;
;
EVTROUTINE HANDLING(#CurrentHint.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
Change (#Loc_Exist #Loc_Save) N;
;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
;
If '(#Loc_Exist = Y) *and (#CurrentHint.Value *ne *Blanks)';
Set #Location<#CurrentLocation> LocationHint(#CurrentHint);
Endif;
;
EndRoutine;
;
* Handle the delete button;
;
EVTROUTINE HANDLING(#Btn_Delete.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Change (#Loc_Exist #Loc_Save) N;
;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
;
If '#Loc_Exist = Y';
Invoke #Location<#CurrentLocation>.DeSelect;
Set #Location<#CurrentLocation> Active(N);
Invoke #Location<#CurrentLocation>.Show;
Set (#CurrentLocation #CurrentHint) Value(' ');
Set (#Btn_New #Btn_Delete) Enabled(False);
Endif;
;
EndRoutine;
;
;
* Handle a location signalling its existence back to us. Two modes are ;
* supported. First is simply to verify whether the location exists,;
* second is to handle creation of a working list of all locations. ;
;
;
EvtRoutine Handling(#Location<>.LocationExists) Com_Sender(#sender);
;
Define #Loc_Exist RefFld(#Std_CodeS) ;
Define #Loc_Save RefFld(#Std_CodeS) ;
;
Define #Save_Id RefFld(#Std_CodeL);
Define #Save_Hint RefFld(#Std_TextL);
Define #Save_LocX RefFld(#Std_Num);
Define #Save_LocY RefFld(#Std_Num);
Define #Save_Hgt RefFld(#Std_Num);
Define #Save_Wid RefFld(#Std_Num);
;
Def_List #Loc_List (#Save_Id #Save_Hint #Save_Locx #Save_LocY #Save_Hgt #Save_Wid) type(*working) entrys(9999);
;
Change #Loc_Exist Y;
;
If '#Loc_Save = Y';
Change #Save_Id #Sender.LocationId ;
Change #Save_Hint #Sender.LocationHint ;
Change #Save_LocX #Sender.LocationX ;
Change #Save_LocY #Sender.LocationY ;
Change #Save_Hgt #Sender.LocationHeight;
Change #Save_Wid #Sender.LocationWidth ;
Add_Entry #Loc_List;
Endif;
;
EndRoutine;
;
* Handle the New Location push button ;
;
EVTROUTINE HANDLING(#BTN_NEW.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Set #Location<#CurrentLocation> Active(Y) Locationid(#CurrentLocation) LocationHint(#CurrentHint) LocationX(1) LocationY(1) Mapheight(#Image.Height) MapWidth(#Image.Width) Parent(#ImagePanel) MaximumXValue(#Image.ImageWidth) MaximumYValue(#Image.ImageHeight) ScaleHeight(#Image.ImageHeight) ScaleWidth(#Image.ImageWidth) LocationHeight(#Loc_Height.Value) LocationWidth(#Loc_Width.Value);
Invoke #Location<#CurrentLocation>.Show;
Invoke #Location<#CurrentLocation>.Select;
ENDROUTINE;
;
* Handle Location Height changed for current or all locations;
;
EVTROUTINE HANDLING(#Loc_Height.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
if '#All_Locations.ButtonState = Checked';
Set #Location<> LocationHeight(#Loc_Height.Value);
Else;
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation.Value> LocationHeight(#Loc_Height.Value);
Endif;
Endif;
ENDROUTINE;
;
* Handle Location Width changed for current or all locations;
;
EVTROUTINE HANDLING(#Loc_Width.Changed) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
if '#All_Locations.ButtonState = Checked';
Set #Location<> LocationWidth(#Loc_Width.Value);
Else;
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation.Value> LocationWidth(#Loc_Width.Value);
Endif;
Endif;
ENDROUTINE;
;
* Handle size reset button usage;
;
EVTROUTINE HANDLING(#Btn_Reset.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
Set (#Loc_Height #Loc_Width) Value(6);
if '#All_Locations.ButtonState = Checked';
Set #Location<> LocationWidth(6) LocationHeight(6);
Else;
Change (#Loc_Exist #Loc_Save) N;
Invoke #Location<>.QueryExistence OfLocId(#CurrentLocation);
If '#Loc_Exist = Y';
Set #Location<#CurrentLocation.Value> LocationWidth(6) LocationHeight(6);
Endif;
Endif;
ENDROUTINE;
;
* Restore previously saved locations from disk file, or create default set of locations;
;
;
MthRoutine RestoreLocations;
;
Use Transform_File (#Loc_List #Save_File T) (#BRetCode);
;
* If file data found, use it's data to create location instances;
;
If '#BRetCode *ne ER';
;
SelectList #Loc_List;
Set #location<#Save_Id> Locationid(#Save_Id) LocationHint(#Save_Hint) LocationX(#Save_LocX) LocationY(#Save_LocY) LocationHeight(#Save_Hgt) LocationWidth(#Save_Wid);
EndSelect;
;
* Else .... create default data by hard code ;
;
Else;
Use Clr_Messages;
Set #location<SYD> Locationid(SYD) LocationHint('Sydney, Australia') LocationX(370) locationy(196);
Set #location<LON> Locationid(LON) LocationHint('London, England') LocationX(182) locationy(67);
Set #location<NYK> Locationid(NYK) LocationHint('New York, USA') LocationX(88) locationy(85);
Set #location<CHG> Locationid(CHG) LocationHint('Chicago, USA') LocationX(70) locationy(82);
Set #location<TOK> Locationid(TOK) LocationHint('Tokyo, Japan') LocationX(355) locationy(92);
Set #location<JBG> Locationid(JBG) LocationHint('Johannesberg, South Africa') LocationX(218) locationy(183);
Set #location<ROM> Locationid(ROM) LocationHint('Rome, Italy') LocationX(200) locationy(83);
Set #location<PAR> Locationid(PAR) LocationHint('Paris, France') LocationX(187) locationy(72);
Set #location<BEJ> Locationid(BEJ) LocationHint('Bejing, China') LocationX(336) locationy(77);
Set #location<TOR> Locationid(TOR) LocationHint('Toronto, Canada') LocationX(84) locationy(76);
Endif;
;
* Tell ALL the location components created about the scaling system ;
* being utilized. In this case we are using a scaling system based;
* on the pixel locations on the bitmap (view the bitmap with MS-Paint;
* to see why the values used were used). So the scaling system is ;
* exactly the same as the height and width of the image (top left;
* is 0,0). ;
;
Set #Location<> Parent(#ImagePanel) MaximumXValue(#Image.ImageWidth) MaximumYValue(#Image.ImageHeight) ScaleHeight(#Image.ImageHeight) ScaleWidth(#Image.ImageWidth);
;
EndRoutine;
;
* Handle Edit / View modes of display ;
;
EVTROUTINE HANDLING(#BTN_EDIT.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
;
If '#Btn_Edit.Caption = ''Edit''';
Set #Btn_Edit caption('View');
Set (#GpBX_1 #GpBx_2 #Control) Visible(True) ;
Else;
Set #Btn_Edit caption('Edit') ;
Set (#GpBX_1 #GpBx_2 #Control) Visible(False) ;
Endif;
;
ENDROUTINE;
;
END_COM;