Reusable Part VL_SAM110 : World Map Locations
Name: VL_SAM110
Description: The following RDMLX reusable part represents a single location on the world map created and managed by VL_SAM111.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM DISPLAYPOSITION(1) FORMPOSITION(ScreenCenter) HEIGHT(6) TABPOSITION(1) WIDTH(6);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#LOCATION) DISPLAYPOSITION(1) HEIGHT(6) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(1) TOP(0) WIDTH(6);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#MAP_HEIGHT);
DEFINE_COM CLASS(#STD_NUM) NAME(#MAP_WIDTH);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#SCALE_HEIGHT);
DEFINE_COM CLASS(#STD_NUM) NAME(#SCALE_WIDTH);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#MAX_XVAL);
DEFINE_COM CLASS(#STD_NUM) NAME(#MAX_YVAL);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#LOC_X);
DEFINE_COM CLASS(#STD_NUM) NAME(#LOC_Y);
;
DEFINE_COM CLASS(#STD_CODEL) NAME(#LOC_ID);
;
DEFINE_COM CLASS(#STD_CODES) NAME(#IS_ACTIVE);
Def_Cond *Active '#Is_Active = Y' ;
;
* Proprties stored for each instance of a location ;
;
Define_pty MapHeight set(*auto #Map_Height) ;
Define_pty MapWidth set(*auto #Map_Width) ;
;
Define_pty ScaleHeight set(*auto #Scale_Height) ;
Define_pty ScaleWidth set(*auto #Scale_Width) ;
;
Define_pty MaximumXValue set(*auto #Max_XVal) ;
Define_pty MaximumYValue set(*auto #Max_YVal) ;
;
Define_pty Active set(*Auto #Is_Active) get(*auto #Is_Active);
;
Define_pty LocationX set(*auto #Loc_X) get(*auto #Loc_X) ;
Define_pty LocationY set(*auto #Loc_Y) get(*auto #Loc_Y);
;
Define_pty LocationId set(*auto #Loc_ID) get(*auto #Loc_ID) ;
;
Define_pty LocationHint set(SetHint) Get(GetHint) ;
;
Define_pty LocationHeight set(SetHeight) Get(GetHeight) ;
Define_pty LocationWidth set(SetWidth) Get(GetWidth) ;
;
Define_Evt LocationSelected;
Define_Map *Input #Std_CodeL #SelectedId ;
Define_Map *Input #Std_TextL #SelectedHint;
;
Define_Evt LocationExists;
;
* Define other work variables;
;
Define #Realized RefFld(#Std_CodeS) Default(N);
;
Define #BMP_Black *Char 100;
Define #BMP_Red *Char 100;
;
* Property Get and Set routines;
;
PtyRoutine SetHint;
Define_Map *Input #Std_TextL #Prop001;
Set (#Com_Owner #Location) Hint(#Prop001.Value);
EndRoutine;
;
PtyRoutine GetHint;
Define_Map *Output #Std_TextL #Prop006;
Change #Std_TextL #Com_Owner.Hint;
Set #Prop006 Value(#Std_TextL);
EndRoutine;
;
PtyRoutine SetHeight;
Define_Map *Input #Std_Num #Prop002;
Set (#Com_Owner #Location) Height(#Prop002.Value);
EndRoutine;
;
PtyRoutine GetHeight;
Define_Map *Output #Std_Num #Prop003;
Set #Prop003 Value(#Com_Owner.Height);
EndRoutine;
;
PtyRoutine SetWidth;
Define_Map *Input #Std_Num #Prop004;
Set (#Com_Owner #Location) Width(#Prop004.Value);
EndRoutine;
;
PtyRoutine GetWidth;
Define_Map *Output #Std_Num #Prop005;
Set #Prop005 Value(#Com_Owner.Width);
EndRoutine;
;
* Instance Creation;
;
EvtRoutine Handling(#Com_Owner.CreateInstance);
Use TConcat (*Part_Dir_Source Vl_sam104a.bmp) (#BMP_Black);
Use TConcat (*Part_Dir_Source Vl_sam104b.bmp) (#BMP_Red);
Set #Location FileName(#BMP_Black);
Set #Is_Active Value(Y);
EndRoutine;
;
* Handle request to query existence of a location;
;
MthRoutine QueryExistence;
Define_Map *Input #Std_CodeL #OfLocId ;
If '(#OfLocId.Value = #Loc_ID.Value) *and (#Is_Active.Value = Y)';
Signal LocationExists;
Endif;
EndRoutine;
;
* Handle request to enumerate details;
;
MthRoutine EnumerateExistence;
If *Active;
Signal LocationExists;
Endif;
EndRoutine;
;
* Select, DeSelect and Show the location instance at the computed co-ordinates;
;
MthRoutine Select;
Change #Std_TextL #Location.Hint;
Signal LocationSelected SelectedId(#Loc_ID.Value) SelectedHint(#Std_TextL) ;
Set #Location FileName(#BMP_Red);
EndRoutine;
;
MthRoutine DeSelect;
If '#Location.FileName *ne #BMP_Black';
Set #Location FileName(#BMP_Black);
Endif;
EndRoutine;
;
MthRoutine Show ;
;
Define #aX RefFld(#Std_Num);
Define #aY RefFld(#Std_Num);
;
if '#Loc_X.Value < 0';
Set #Loc_X Value(0);
Endif;
;
Change #Std_Num '#Max_XVal.Value - 2';
if '#Loc_X.Value > #Std_Num';
Set #Loc_X Value(#Std_Num);
Endif;
;
Change #Ax '#Loc_X.Value * (#Map_Width.Value / #Scale_Width.Value)' precision(30 9) ;
;
if '#Loc_Y.Value < 0';
Set #Loc_Y Value(0);
Endif;
;
Change #Std_Num '#Max_YVal.Value - 2';
if '#Loc_Y.Value > #Std_Num';
Set #Loc_Y Value(#Std_Num);
Endif;
;
Change #Ay '#Loc_Y.Value * (#Map_Height.Value / #Scale_Height.Value)' precision(30 9) ;
;
If '#Realized = N';
Invoke #Com_Owner.Realize;
Change #Realized Y;
Endif;
;
Set #Com_Owner Top(#ay) Left(#Ax) Visible(*Active) Enabled(*Active);
;
EndRoutine;
;
* Signal back to owner that the location instance was clicked on;
;
EvtRoutine Handling(#Location.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
If *Active;
Invoke #Com_Owner.Select;
Endif;
EndRoutine;
;
END_COM;
Name: VL_SAM110
Description: The following RDMLX reusable part represents a single location on the world map created and managed by VL_SAM111.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM DISPLAYPOSITION(1) FORMPOSITION(ScreenCenter) HEIGHT(6) TABPOSITION(1) WIDTH(6);
DEFINE_COM CLASS(#PRIM_IMGE) NAME(#LOCATION) DISPLAYPOSITION(1) HEIGHT(6) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(1) TOP(0) WIDTH(6);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#MAP_HEIGHT);
DEFINE_COM CLASS(#STD_NUM) NAME(#MAP_WIDTH);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#SCALE_HEIGHT);
DEFINE_COM CLASS(#STD_NUM) NAME(#SCALE_WIDTH);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#MAX_XVAL);
DEFINE_COM CLASS(#STD_NUM) NAME(#MAX_YVAL);
;
DEFINE_COM CLASS(#STD_NUM) NAME(#LOC_X);
DEFINE_COM CLASS(#STD_NUM) NAME(#LOC_Y);
;
DEFINE_COM CLASS(#STD_CODEL) NAME(#LOC_ID);
;
DEFINE_COM CLASS(#STD_CODES) NAME(#IS_ACTIVE);
Def_Cond *Active '#Is_Active = Y' ;
;
* Proprties stored for each instance of a location ;
;
Define_pty MapHeight set(*auto #Map_Height) ;
Define_pty MapWidth set(*auto #Map_Width) ;
;
Define_pty ScaleHeight set(*auto #Scale_Height) ;
Define_pty ScaleWidth set(*auto #Scale_Width) ;
;
Define_pty MaximumXValue set(*auto #Max_XVal) ;
Define_pty MaximumYValue set(*auto #Max_YVal) ;
;
Define_pty Active set(*Auto #Is_Active) get(*auto #Is_Active);
;
Define_pty LocationX set(*auto #Loc_X) get(*auto #Loc_X) ;
Define_pty LocationY set(*auto #Loc_Y) get(*auto #Loc_Y);
;
Define_pty LocationId set(*auto #Loc_ID) get(*auto #Loc_ID) ;
;
Define_pty LocationHint set(SetHint) Get(GetHint) ;
;
Define_pty LocationHeight set(SetHeight) Get(GetHeight) ;
Define_pty LocationWidth set(SetWidth) Get(GetWidth) ;
;
Define_Evt LocationSelected;
Define_Map *Input #Std_CodeL #SelectedId ;
Define_Map *Input #Std_TextL #SelectedHint;
;
Define_Evt LocationExists;
;
* Define other work variables;
;
Define #Realized RefFld(#Std_CodeS) Default(N);
;
Define #BMP_Black *Char 100;
Define #BMP_Red *Char 100;
;
* Property Get and Set routines;
;
PtyRoutine SetHint;
Define_Map *Input #Std_TextL #Prop001;
Set (#Com_Owner #Location) Hint(#Prop001.Value);
EndRoutine;
;
PtyRoutine GetHint;
Define_Map *Output #Std_TextL #Prop006;
Change #Std_TextL #Com_Owner.Hint;
Set #Prop006 Value(#Std_TextL);
EndRoutine;
;
PtyRoutine SetHeight;
Define_Map *Input #Std_Num #Prop002;
Set (#Com_Owner #Location) Height(#Prop002.Value);
EndRoutine;
;
PtyRoutine GetHeight;
Define_Map *Output #Std_Num #Prop003;
Set #Prop003 Value(#Com_Owner.Height);
EndRoutine;
;
PtyRoutine SetWidth;
Define_Map *Input #Std_Num #Prop004;
Set (#Com_Owner #Location) Width(#Prop004.Value);
EndRoutine;
;
PtyRoutine GetWidth;
Define_Map *Output #Std_Num #Prop005;
Set #Prop005 Value(#Com_Owner.Width);
EndRoutine;
;
* Instance Creation;
;
EvtRoutine Handling(#Com_Owner.CreateInstance);
Use TConcat (*Part_Dir_Source Vl_sam104a.bmp) (#BMP_Black);
Use TConcat (*Part_Dir_Source Vl_sam104b.bmp) (#BMP_Red);
Set #Location FileName(#BMP_Black);
Set #Is_Active Value(Y);
EndRoutine;
;
* Handle request to query existence of a location;
;
MthRoutine QueryExistence;
Define_Map *Input #Std_CodeL #OfLocId ;
If '(#OfLocId.Value = #Loc_ID.Value) *and (#Is_Active.Value = Y)';
Signal LocationExists;
Endif;
EndRoutine;
;
* Handle request to enumerate details;
;
MthRoutine EnumerateExistence;
If *Active;
Signal LocationExists;
Endif;
EndRoutine;
;
* Select, DeSelect and Show the location instance at the computed co-ordinates;
;
MthRoutine Select;
Change #Std_TextL #Location.Hint;
Signal LocationSelected SelectedId(#Loc_ID.Value) SelectedHint(#Std_TextL) ;
Set #Location FileName(#BMP_Red);
EndRoutine;
;
MthRoutine DeSelect;
If '#Location.FileName *ne #BMP_Black';
Set #Location FileName(#BMP_Black);
Endif;
EndRoutine;
;
MthRoutine Show ;
;
Define #aX RefFld(#Std_Num);
Define #aY RefFld(#Std_Num);
;
if '#Loc_X.Value < 0';
Set #Loc_X Value(0);
Endif;
;
Change #Std_Num '#Max_XVal.Value - 2';
if '#Loc_X.Value > #Std_Num';
Set #Loc_X Value(#Std_Num);
Endif;
;
Change #Ax '#Loc_X.Value * (#Map_Width.Value / #Scale_Width.Value)' precision(30 9) ;
;
if '#Loc_Y.Value < 0';
Set #Loc_Y Value(0);
Endif;
;
Change #Std_Num '#Max_YVal.Value - 2';
if '#Loc_Y.Value > #Std_Num';
Set #Loc_Y Value(#Std_Num);
Endif;
;
Change #Ay '#Loc_Y.Value * (#Map_Height.Value / #Scale_Height.Value)' precision(30 9) ;
;
If '#Realized = N';
Invoke #Com_Owner.Realize;
Change #Realized Y;
Endif;
;
Set #Com_Owner Top(#ay) Left(#Ax) Visible(*Active) Enabled(*Active);
;
EndRoutine;
;
* Signal back to owner that the location instance was clicked on;
;
EvtRoutine Handling(#Location.Click) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
If *Active;
Invoke #Com_Owner.Select;
Endif;
EndRoutine;
;
END_COM;