BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Hiding MDI Child form

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
JD
Guest





PostPosted: Fri Nov 28, 2003 2:22 pm    Post subject: Re: Hiding MDI Child form Reply with quote



"Trygve Valøy" <trygvevaloy (AT) hotmail (DOT) com> wrote:
Quote:
[...] Is there any reason why I should not do this?

The real question is ... Is there any (real) reason why you
would want to do this? The usual method is to remove the form
from the autocreate list and dynamically allocte the form at
runtime.

If you want multiple instances, use a local pointer to the
child form.

If you want only one instance, declare a public pointer of the
type of your mdi child and set it to nil during OnCreate. When
the user clicks to initiate that form, check the pointer for
nil. If it is nil then allocate the form else just bring it to
front. Finally, set the public pointer to nil in the child's
OnDestroy event.

In both cases, in the OnClose event of the child form, set the
Action parameter to caFree to have the form delete it's self
when it's closed.

~ JD


Back to top
Peter Below (TeamB)
Guest





PostPosted: Fri Nov 28, 2003 6:57 pm    Post subject: Re: Hiding MDI Child form Reply with quote



In article <3fc745b6$1 (AT) newsgroups (DOT) borland.com>, Trygve Valøy wrote:
Quote:
I found that by overriding TCustomForm.VisibleChanging I can set Visible to
False on a MDI Child form. (A form with FormStyle = fsMDIChild).

Is there any reason why I should not do this?

The Windows MDI subsystem gets terribly confused if you do such things. The
Windows menu will not be updated correctly, for instance, still showing the
hidden MDI child. If the user tries to select that form from the menu
unpredictable things may happen. MDI was not designed to work with hidden
child windows.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
JD
Guest





PostPosted: Mon Dec 01, 2003 11:52 am    Post subject: Re: Hiding MDI Child form Reply with quote



"Trygve Valøy" <trygvevaloy (AT) hotmail (DOT) com> wrote:
Quote:
I would like to create the form and not show it until some
properties are initialized. This can be done by overriding
the constructor, but I wish to use a standard constructor so
forms can be created dynamically by class reference.

I'm just starting to get intimate with Delphi but in CBuilder,
which is delphi at it's core, it's an easy proposition. In
fact, CBuilders are cautioned not to use OnCreate but to use
the ctor instead, which, when one adds a new form to the
project, is the only method in the forms' unit.

What I don't understand is why, if you override the ctor, that
you can't make it part of the class and then dynamically
allocate it:

http://www.drbob42.com/delphi4/overload.htm

~ JD


Back to top
JD
Guest





PostPosted: Mon Dec 01, 2003 2:44 pm    Post subject: Re: Hiding MDI Child form Reply with quote


"Trygve Valøy" <trygvevaloy (AT) hotmail (DOT) com> wrote:
Quote:
[...] You can make it part of the class, but the thing is
different paramaters might be neccesary for different
classes.

Ah - the missing piece.

One possible alternative is to pass the ctor a structure that
it would act on depending on it's members values and you could
also allow for return values there too. You might not like it
but it would solve your problems.

~ JD


Back to top
Peter Below (TeamB)
Guest





PostPosted: Mon Dec 01, 2003 8:15 pm    Post subject: Re: Hiding MDI Child form Reply with quote

In article <3fcb034a$1 (AT) newsgroups (DOT) borland.com>, Trygve Valøy wrote:
Quote:
Have you read these articles?

No.

Quote:
Do you have any experience with these issues?

Again no. MDI does not fit my UI requirements, i never use it.
Quote:


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.