Here's my problem: Form1 is current and in the foreground. A certain
action launches Form2. Now Form2 is in the foreground and Form1 is in
the background. Form2 has a button to launch Form1, but rather than
re-launching a new instance, I want to simply bring the existing
background form back to the foreground. I tried adding a simple Show
call to it, but that seems to show a 2nd instance! How do I bring the
background form to the foreground? I'm thinking it has something to do
with the Hwnd property but I've never played with that before.
Thanks!
--Mike
btw, I use a simple forms management array like this when I launch forms:
FUNCTION AddForm(toFrm as Form, tcID as String, tlSingleInstance as
Logical) as Logical
* Adds form to form manager array (to allow modeless forms without
scope issues)
* mjb 01-04-07 added tlSingleInstance and returning logical now to
indicate good to go (or not)
LOCAL lnCount as Integer, lnLoop as Integer, llOK as Logical,
lcCaption as String, loFrm as Form
llOK = .T. && default to OK
lcCaption = toFrm.Caption
lnCount = INT(ALEN(this.aForms) / 2)
* mjb 01-04-07 if tlSingleInstance, look to see if form is
already existing
IF tlSingleInstance THEN
FOR lnLoop = 1 TO lnCount
loFrm = this.aForms(lnLoop,1)
IF NOT ISNULL(loFrm) THEN
IF ALLTRIM(loFrm.caption) = ALLTRIM(lcCaption) THEN
&& found it already...don't allow this instanatiation
***
*** INSTEAD OF THIS MSGBOX BELOW, I WANT TO BRING THE EXISTING
BACKGROUND FORM TO THE FOREGROUND!!!
***
MESSAGEBOX("You already have this form open and
cannot open multiple instances of it. " + ADMINMSG,16,"Cannot open
multiple instances of form.")
llOK = .F.
EXIT
ENDIF
ENDIF && NOT ISNULL(loFrm)
ENDFOR
ENDIF
IF llOK THEN
DIMENSION this.aForms(lnCount + 1,2)
this.aForms(lnCount + 1,1) = toFrm
this.aForms(lnCount + 1,2) = tcID
ENDIF && llOK
RETURN llOK
ENDFUNC && AddForm(toFrm as Form, tcID as String, tlSingleInstance
as Logical) as Logical
--
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.