Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nobody is replying...
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00835408
Message ID:
00835650
Views:
7
Peter,

Here's what you really want:
--------------
The main form will come on top if the second form is an As-Top-Level-Form and if both have Desktop=False. This is almost okay, but I'd like to have the second form to be a child, for in that case the user can minimize both with one click on the minimize button of the main form.
--------------------

You're making life too complicated for yourself; by choosing to resolve this particular requirement with the wrong sort of kludge <s>.

Just because you want both forms to minimize at the same time doesn't mean that one form should be a child of the other -- especially when, in this case, you really don't want to display one inside the other.

Top forms and their so-called children are designed to give you one type of Windows interface which you are not actually using if you don't put one inside the other <s>.

What you want to do is make sure they both minimize at the same time, so that's what you should do. You need to find some way to trigger the behavior, by using an event that triggers at the appropriate time.

Before I offer a suggestion on an appropriate trigger, here's one more thing to consider:

You shouldn't need to create special references to be shared between the forms -- You can give them member properties with references to each other, if you really want, if you're careful about nulling them out properly <s>.(This is always a problem with forms, you have to make sure to release the references properly *before* Fox starts destroying objects, or your application will be prone to crash, depending on in what order forms happen to close.) You can also create global variables, as somebody else has suggested -- in your application it probably won't do any harm.

You just shouldn't need to.

Remember that both forms are in the _SCREEN.Forms collection. Whether or not you can see _SCREEN in your top form application is irrelevant to this fact. You always have these references available.

So you should be able to make their behavior match by making them both ShowWindow = 2 (Top Forms) and by using something like the following. I'm sketching, not testing this out, but something like this should work with two top forms:
	PROCEDURE LostFocus
	   DODEFAULT()
	   LOCAL xx 
	   xx = THIS.WindowState
            FOR EACH oForm IN _SCREEN.Forms
              IF oForm.Name # THIS.Name
                 oForm.WindowState = xx
              ENDIF
            ENDFOR
	ENDPROC
>L<
Previous
Reply
Map
View

Click here to load this message in the networking platform