Form VL_SAM069: Dynamic Tool Bars in a Free Floating Window

LANSA

Form VL_SAM069: Dynamic Tool Bars in a Free Floating Window
Name: VL_SAM069

Description: The following RDMLX form is used by VL_SAM068 to dynamically create a tool bar in a free floating form.
* ===================================================================
*
* Component : VL_SAM069
* Type : Form
* Ancestor : PRIM_FORM
*
* Description : Presents Dynamic Tool Bars in a Free Floating Window
* The following RDMLX form is used by VL_SAM068 to dynamically create a tool bar
* in a free floating form.
*
* Disclaimer : The following material is supplied as sample 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) Bordericons(SystemMenu) Formposition(ScreenCenter) Formstyle(StayOnTop) Framestyle(ToolWindow) Height(71) Left(359) Top(158) Width(267)
Define_Com Class(#VL_SAM068) Name(#TOOLFORM) Parent(#COM_OWNER) Tabstop(False)

Define_Evt Name(SwitchtoAttachMode)

Define_Evt Name(TooBarButtonClicked)
Define_Map For(*input) Class(#Std_Obj) Name(#WithName)

Define_Pty Name(Orientation) Get(GetOrientation) Set(SetOrientation)

Define Field(#VISNAME) Reffld(#STD_OBJ)
Define Field(#WORKNAME) Reffld(#VISNAME)
Define Field(#VISHINT) Reffld(#STD_TEXTL)
Define Field(#VISBITMAP) Reffld(#STD_TEXTS)
Define Field(#VISCOUNT) Reffld(#STD_NUM)
Define Field(#LOOPCOUNT) Length(*REFFLD *PLUS 1) Reffld(#STD_NUM)

Def_List Name(#VISLIST) Fields(#VISNAME #VISHINT #VISBITMAP) Counter(#VISCOUNT) Type(*WORKING) Entrys(100)

Define Field(#CURCOUNT) Reffld(#STD_NUM)

Define Field(#ORIENT) Reffld(#STD_CODES) Default(H)
Define Field(#CURORIENT) Reffld(#ORIENT)
Def_Cond Name(*ORIENTVER) Cond('#Orient = V')

* Route Orientation request through into reusable part

Ptyroutine Name(SetOrientation)
Define_Map For(*input) Class(#Std_Codes) Name(#Property1)
Set Com(#ToolForm) Orientation(#Property1.Value)
Endroutine

* Route Orientation request through into reusable part

Ptyroutine Name(GetOrientation)
Define_Map For(*output) Class(#Std_Codes) Name(#Property2)
Set Com(#Property2) Value(#ToolForm.Orientation)
Endroutine

* Set reusable part to mode F (as Floating Fom)

Evtroutine Handling(#com_Owner.CreateInstance)
Set Com(#ToolForm) Operationmode(F)
Endroutine

* Handle request to show the floating form

Mthroutine Name(uShowForm)
Invoke Method(#Com_Owner.RestoreForm)
Invoke Method(#Com_Owner.ShowForm)
Set Com(#Com_Owner) Height(#ToolForm.BarHeight) Width(#ToolForm.BarWidth)
Endroutine

* Route request straight through to the reusabe component

Mthroutine Name(AddToolBarItem)
Define_Map For(*input) Class(#Std_CodeL) Name(#UseName)
Define_Map For(*input) Class(#Std_TextL) Name(#UseHint)
Define_Map For(*input) Class(#Std_TextS) Name(#UseBitMap)
Invoke Method(#ToolForm.AddToolBarItem) Usename(#UseName.Value) Usehint(#UseHint.Value) Usebitmap(#UseBitMap.Value)
Endroutine

* Route request straight through to the reusable component

Mthroutine Name(AlterToolBarItem)
Define_Map For(*input) Class(#Std_CodeL) Name(#Named)
Define_Map For(*input) Class(#Std_CodeL) Name(#SetEnabled)
Invoke Method(#ToolForm.AlterToolBarItem) Named(#Named.Value) Setenabled(#SetEnabled.Value)
Endroutine

* Route signal straight through to the reusable component

Evtroutine Handling(#ToolForm.TooBarButtonClicked) Withname(#ID1)
Signal Event(TooBarButtonClicked) Withname(#ID1.Value)
Endroutine

* Resize the form when orientation changes

Evtroutine Handling(#ToolForm.OrientationChanged)
Set Com(#Com_Owner) Height(#ToolForm.BarHeight) Width(#ToolForm.BarWidth)
Endroutine

* Hide form and reroute request through when switching back to attached mode

Evtroutine Handling(#ToolForm.SwitchtoAttachMode)
Execute Subroutine(ATTACH)
Endroutine

Evtroutine Handling(#COM_OWNER.CloseQuery) Options(*NOCLEARMESSAGES *NOCLEARERRORS) Continue(#uoption)
* If the user presses the close button, we interpret this as meaning re-attach the tool bar
Set Com(#uOption) Value(FALSE)
Execute Subroutine(ATTACH)
Endroutine

* Hide form and reroute request through when switching back to attached mode

Subroutine Name(ATTACH)
Invoke Method(#Com_Owner.HideForm)
Signal Event(SwitchtoAttachMode)
Endroutine

End_Com