S_234R

LANSA

S_234R

* ===================================================================
*
* Component : S_234R
* Type : Reusable Part
* Ancestor : PRIM_PANL
*
* Description : Reusable Component Screen Position
*
*
* 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_PANL) Displayposition(1) Height(61) Left(0) Tabposition(1) Top(0) Visualstyle(#VS_WARN) Width(132)
Define_Com Class(#PRIM_TIMR) Name(#POSITION_TIMER) Interval(0)
Define_Com Class(#PRIM_LABL) Name(#TOP_TEXT) Caption('Top') Displayposition(4) Height(16) Left(0) Parent(#COM_OWNER) Tabposition(4) Tabstop(False) Top(0) Width(70)
Define_Com Class(#PRIM_LABL) Name(#LEFT_TEXT) Caption('Left') Displayposition(3) Height(16) Left(0) Parent(#COM_OWNER) Tabposition(3) Tabstop(False) Top(16) Width(70)
Define_Com Class(#PRIM_LABL) Name(#SCREEN_TOP_TEXT) Caption('ScreenTop') Displayposition(2) Height(16) Left(0) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Top(32) Width(70)
Define_Com Class(#PRIM_LABL) Name(#SCREEN_LEFT_TEXT) Caption('ScreenLeft') Displayposition(1) Height(16) Left(0) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(48) Width(70)
Define_Com Class(#PRIM_LABL) Name(#TOP_VALUE) Caption('<text>') Displayposition(8) Height(16) Left(69) Parent(#COM_OWNER) Tabposition(8) Tabstop(False) Top(0) Width(36)
Define_Com Class(#PRIM_LABL) Name(#LEFT_VALUE) Caption('<text>') Displayposition(6) Height(16) Left(69) Parent(#COM_OWNER) Tabposition(6) Tabstop(False) Top(16) Width(36)
Define_Com Class(#PRIM_LABL) Name(#SCREEN_TOP_VALUE) Caption('<text>') Displayposition(7) Height(16) Left(69) Parent(#COM_OWNER) Tabposition(7) Tabstop(False) Top(32) Width(36)
Define_Com Class(#PRIM_LABL) Name(#SCREEN_LEFT_VALUE) Caption('<text>') Displayposition(5) Height(16) Left(69) Parent(#COM_OWNER) Tabposition(5) Tabstop(False) Top(48) Width(36)
Define_Com Class(#PRIM_STTC) Name(#STTC_1) Displayposition(9) Drawtype(TriangleRight) Height(60) Left(112) Linewidth(2) Parent(#COM_OWNER) Tabposition(9) Top(0) Visualstyleofparent(False) Width(20)

* Define the uComponent property. This property is used by the owner
* form to associate this reusable component with a control (eg: a push
* button or radio button) that it has on it's own form.

Define_Pty Name(uComponent) Set(Set_uComponent)
Define_Com Class(#Prim_Ctrl) Name(#Pty_uComponent) Reference(*Dynamic)
Ptyroutine Name(Set_uComponent)
Define_Map For(*input) Class(#Prim_Ctrl) Name(#Property_001) Pass(*By_Reference)

* Keep details of the associated control on the main form

Set_Ref Com(#Pty_uComponent) To(#Property_001)

* Realize an instance of this component

Invoke Method(#Com_Owner.Realize)

* Start the position timer

Set Com(#Position_Timer) Interval(333)

Endroutine

* The position timer will (re)calculate the screen position
* details every 1/3 second

Evtroutine Handling(#Position_Timer.Tick) Options(*NOCLEARMESSAGES *NOCLEARERRORS)

Define Field(#Left) Reffld(#STD_NUM)
Define Field(#Top) Reffld(#STD_NUM)

* Calculate the associated components position and from this
* position this reusable part

Change Field(#Left) To('#Pty_uComponent.Left - #Com_Owner.Width')
Change Field(#Top) To('#Pty_uComponent.Top - (#Com_Owner.Height / 2)')
Set Com(#Com_Owner) Left(#Left) Top(#Top)

* Set the values for the to display the components position details

Use NUMERIC_STRING With_Args(#Pty_uComponent.Top) To_Get(#STD_TEXTS)
Set Com(#Top_Value) Caption(#Std_Texts)

Use NUMERIC_STRING With_Args(#Pty_uComponent.Left) To_Get(#STD_TEXTS)
Set Com(#Left_Value) Caption(#Std_Texts)

Use NUMERIC_STRING With_Args(#Pty_uComponent.ScreenTop) To_Get(#STD_TEXTS)
Set Com(#Screen_Top_value) Caption(#Std_Texts)

Use NUMERIC_STRING With_Args(#Pty_uComponent.ScreenLeft) To_Get(#STD_TEXTS)
Set Com(#Screen_Left_Value) Caption(#Std_Texts)

Endroutine

End_Com