Finding a Window

Visual LANSA Framework

Finding a Window

You can find a specific window in your programs like this:

 

 

* Define a temporary class #VF_SY154 reference. 

* Use VL's F2=Feature help to explore the properties

* and methods that class #VF_SY154 exposes for you to use.

 

Define_Com Class(#VF_SY154) Name(#Window) Reference(*Dynamic)

 

* Ask the Framework manager to locate a window by name and return a reference

 

#Window <= #AvFrameworkManager.avWindow<'USER_EMPLOYEES'>  

 

* Remember to handle the fact the window might be found (or not)  

 

If (#Window *isNot *Null)

Use Message_box_Add ('The window named' #Window.WindowName 'is at position' #Window.Top #Window.Left)

Else

Use Message_box_Add ('No Window named USER_EMPLOYEES is currently open')

Endif

 

Use Message_Box_show

 

* Just to be absolutely sure, make the Window reference null to free it.

* You should never hang onto VF_SY154 references in your code.

 

#Window <= *Null

 

This code would display message boxes like these:

 

 

 

Important Note:  Always free #VF_SY154 object references in your programs.