Owner vs Parent vs ParentForm

  • Thread starter Thread starter Tom W
  • Start date Start date
Tom,
| What's the difference in these three?
| Owner vs Parent vs ParentForm

Form.Owner - Is the Form that "owns" this form. For example a modless
Find/Replace dialog would be Owned by Notepad's main window. If you minimize
the main Form, the owned form will minimize, if you restore the main form,
the owned form will restore... Normally used for "tool" windows in SDI
applications...

Control.Parent - Is the immediate control that this control is placed on.
For example an option button placed in a Panel or GroupBox would have that
Panel or GroupBox as its Parent.

ContainerControl.ParentForm - is the Form that this ContainerControl is
ultimately placed on, however the Parent of the ContainerControl maybe
another ContainerControl, which may have another Control as its Parent,
which may then be a Form. Basically this does a Control.Parent until it
finds a type that inherits from Form.

Hope this helps
Jay

| What's the difference in these three?
 
Tom,

dim frm as myform
frm.owner = me

In the myform you can say
me.owner.textbox1 or whatever

me.ismidicontainer = true
frm.parent = me
me contains a than a colection of zero or more childs in its
mdichildscollection

me.parentform.menu1 'in a mdi form a menu on the mdicontainer

I hope this helps,

Cor
 
Cor,
| me.ismidicontainer = true
| frm.parent = me
| me contains a than a colection of zero or more childs in its
| mdichildscollection
Your example appears to be Form.MdiParent and not Control.Parent.

Hope this helps
Jay

| Tom,
|
| dim frm as myform
| frm.owner = me
|
| In the myform you can say
| me.owner.textbox1 or whatever
|
| me.ismidicontainer = true
| frm.parent = me
| me contains a than a colection of zero or more childs in its
| mdichildscollection
|
| me.parentform.menu1 'in a mdi form a menu on the mdicontainer
|
| I hope this helps,
|
| Cor
|
|
| "Tom W" <[email protected]> schreef in bericht
| | > What's the difference in these three?
|
|
 
Sorry,

I see I was answering with the parent a mdiparent.

:-(

Cor
 
Jay,

I saw it, I posted my correction before I saw this message

Cor
 
OK great, owner provides functionality that ties forms togther when
minimizing and maximizing. But you can reference Parent and ParentForm
from a form class. Can that just be used as another way to tie them
together that doesn't provide any functionality?

Tom
 
Tom,
Parent is a Control to Control relationship.

ParentForm is a Control to Form relationship.

I really don't see how you would see a Form to Form relationship in either
Parent or ParentForm, unless you placed one Form as Child *Control* of a
second Form. Then however your "Form" is no longer a Form, but its now a
Control!

What specifically do you have in mind?

Hope this helps
Jay

| OK great, owner provides functionality that ties forms togther when
| minimizing and maximizing. But you can reference Parent and ParentForm
| from a form class. Can that just be used as another way to tie them
| together that doesn't provide any functionality?
|
| Tom
|
| Jay B. Harlow [MVP - Outlook] wrote:
| > Tom,
| > | What's the difference in these three?
| > | Owner vs Parent vs ParentForm
| >
| > Form.Owner - Is the Form that "owns" this form. For example a modless
| > Find/Replace dialog would be Owned by Notepad's main window. If you
minimize
| > the main Form, the owned form will minimize, if you restore the main
form,
| > the owned form will restore... Normally used for "tool" windows in SDI
| > applications...
| >
| > Control.Parent - Is the immediate control that this control is placed
on.
| > For example an option button placed in a Panel or GroupBox would have
that
| > Panel or GroupBox as its Parent.
| >
| > ContainerControl.ParentForm - is the Form that this ContainerControl is
| > ultimately placed on, however the Parent of the ContainerControl maybe
| > another ContainerControl, which may have another Control as its Parent,
| > which may then be a Form. Basically this does a Control.Parent until it
| > finds a type that inherits from Form.
| >
| > Hope this helps
| > Jay
| >
| > | > | What's the difference in these three?
| >
| >
 
I don't have anything specific in mind beyond what Owner offers, but I
didn't understand why Parent and ParentForm were available on the form
class.
 
Tom,
I don't have anything specific in mind beyond what Owner offers, but I
didn't understand why Parent and ParentForm were available on the form
class.
As Jay stated, forms inherits from controls, because of that you will see
all methods, events and properties from Control. That does not mean they are
usefull. There are which are complete unusable. By instance the
backgroundimage in a textbox.

I hope this gives some more ideas

Cor
 
Good enough. Thanks

Tom
Tom,



As Jay stated, forms inherits from controls, because of that you will see
all methods, events and properties from Control. That does not mean they are
usefull. There are which are complete unusable. By instance the
backgroundimage in a textbox.

I hope this gives some more ideas

Cor
 
Tom,
As Cor & I stated. Form inherits from Control. Which means that Form has all
the properties & methods that Control has. This can be very useful,
especially when you use a Form as a Control, in which case you need those
properties. However when using a Form as a Form, then those properties may
or may not be that useful.

Hope this helps
Jay

|I don't have anything specific in mind beyond what Owner offers, but I
| didn't understand why Parent and ParentForm were available on the form
| class.
|
| Jay B. Harlow [MVP - Outlook] wrote:
| > Tom,
| > Parent is a Control to Control relationship.
| >
| > ParentForm is a Control to Form relationship.
| >
| > I really don't see how you would see a Form to Form relationship in
either
| > Parent or ParentForm, unless you placed one Form as Child *Control* of a
| > second Form. Then however your "Form" is no longer a Form, but its now a
| > Control!
| >
| > What specifically do you have in mind?
| >
| > Hope this helps
| > Jay
| >
| > | > | OK great, owner provides functionality that ties forms togther when
| > | minimizing and maximizing. But you can reference Parent and ParentForm
| > | from a form class. Can that just be used as another way to tie them
| > | together that doesn't provide any functionality?
| > |
| > | Tom
| > |
| > | Jay B. Harlow [MVP - Outlook] wrote:
| > | > Tom,
| > | > | What's the difference in these three?
| > | > | Owner vs Parent vs ParentForm
| > | >
| > | > Form.Owner - Is the Form that "owns" this form. For example a
modless
| > | > Find/Replace dialog would be Owned by Notepad's main window. If you
| > minimize
| > | > the main Form, the owned form will minimize, if you restore the main
| > form,
| > | > the owned form will restore... Normally used for "tool" windows in
SDI
| > | > applications...
| > | >
| > | > Control.Parent - Is the immediate control that this control is
placed
| > on.
| > | > For example an option button placed in a Panel or GroupBox would
have
| > that
| > | > Panel or GroupBox as its Parent.
| > | >
| > | > ContainerControl.ParentForm - is the Form that this ContainerControl
is
| > | > ultimately placed on, however the Parent of the ContainerControl
maybe
| > | > another ContainerControl, which may have another Control as its
Parent,
| > | > which may then be a Form. Basically this does a Control.Parent until
it
| > | > finds a type that inherits from Form.
| > | >
| > | > Hope this helps
| > | > Jay
| > | >
| > | > | > | > | What's the difference in these three?
| > | >
| > | >
| >
| >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top