Hi Rene.
I have an application that show the list of all open window similar to the MS Word. For example I have five open window on my application such as "Window1", "Window2", ..., "Window5". Assuming that the "Window3" is on the bottom of another window. If I select the "Window3" from the selection popup on my application I want the the "Window3" to be the active window similar on the MS Word.The way that I handle this is that my application has a form manager object that handles launching and releasing all the non-modal forms in my app. This form manager maintains an internal array with inforation about each form, including a unique form ID that is generated whent the form is instantiated. The launchform() method instantiates the form, adds the information about it to the correct row in the form manager's array, and sets the form's cFormID property with the unique form id that was generated for it. The form manager then calls the AddFormName2Menu() method and this is what that method looks like:
IF CNTBAR("Window") = 0 OR GETBAR("Window", CNTBAR("Window")) < 0
lnNoMenu = CNTBAR("Window") + 1
ELSE
lnNoMenu = GETBAR("Window", CNTBAR("Window")) + 1
ENDIF
DEFINE BAR lnNoMenu OF Window PROMPT THIS.oActiveForm.Caption AFTER _MLAST
lcFormID = THIS.oActiveform.cFormID
lcCommand = 'ON SELECTION BAR ' + TRANSFORM( lnNoMenu ) + ' of Window '
lcCommand = lcCommand + "oFormManager.ActivateForm( '" + lcFormID + "' )"
&lcCommand
Then, my form managers's ActivateForm() method just looks like this:
LPARAMETERS tcFormID
LOCAL lnRow
lnRow = ASCAN( This.aForms, tcFormID, 1, -1, 3, 15 )
IF lnRow > 0
This.aForms[ lnRow, 2 ].Show()
ENDIF