I like your suggestion better. So I put the following as a "Procedure" in my Main Menu and Shortcut menu for the Navigator selection:
DO GetForm WITH cForm
I've created the following function, "GetForm" in my stored procedures"
FUNCTION GetForm
PARAMETERS cForm
IF _Screen.FormCount > 0
FOR EACH loForm IN _Screen.Forms
IF loForm.Name = cForm
loForm.Activate()
ENDIF
ENDFOR
ELSE
DO FORM (cForm)
ENDIF
ENDFUNC
That way I can use the same function for checking for a form and launching if necessary using the same process for each form.
Thank you so much for your help.
>I would rather itterate through screen's form collection to check if form already exists.
FOR EACH loForm IN _SCREEN.Forms
> IF loForm.Name = < >
>* or
> IF loForm.Caption = < >
>...
>ENDFOR
>
>>Sergey,
>>
>>Thanks so much for that additional info. That cleared it up for me and I now I have a RightClick() method on my main screen that launches my shortcut menu called mnushort.mpr. However, there is one little question on that. (hope I can ask this within this thread.)
>>
>>One of the choices on that shortcut menu is to run my main "Navigator" form. I launch it the same way on both the shortcut menu and my main menu, "DO FORM navigator." In the Load event of this form I have the following code to prevent two instances of the form from being created:
>>
>>
>>IF TYPE("Navigator") = "O" and !ISNULL(Navigator)
>> Navigator.Show()
>> RETURN .F.
>>ENDIF
>>
>>
>>The form is recognized as an "Object" when launched from the Main menu but not from my Shortcut menu. Why would that be?