Custom Control: Container inside container... 
Author Message
 Custom Control: Container inside container...

I am trying to create my own custom Tab Control, but I can't seem to make it
so you can switch tabs at design time (just like the tab control that comes
with VB) and have the controls inside each tab show and hide.  Right now I
can only get my control to work as one container.  Help is appreciated.

Thanks,
Aaron



Sat, 04 Oct 2003 07:18:25 GMT  
 Custom Control: Container inside container...
Setting a control's Visible property, at design time, has no effect on the
control. If it did, you would lose controls on the form. The SSTab control
also only has one container. It just moves all of the controls, which are
not on the current tab, off screen to the left. When a tab becomes current,
it moves the controls back into place and moves the previous tab's controls
off screen. To hide the controls, just move them all the same distance to
keep their relative positions intact (ie. move each control's Left -75000 to
hide it and +75000 to show it, so all of the controls are in the correct
place on the tab, when visible).

Note: A 1600 x 1200 resolution has 24000 twips horizontally, so it's
possible to have a control's right edge close to 24000. Resolutions of 2000
x 1600 are becoming more popular every day, and that makes it possible to
have a control's right edge close to 30000. You may want to consider using
at least 75000 or more for your offset to ensure the entire control is off
screen. SSTab currently uses 75000.

To see SSTab's method:

(1) Start a new project.
(2) Add an SSTab control with 3 tabs.
(3) Place a Label control on each tab
    (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2 respectively)
(4) Copy this code to the form:

Private Sub Form_Click()
    Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
End Sub

Run the app and click on the form. Then switch tabs and click on the form
again.

Hope this helps,

Rocky Clark (Kath-Rock Software)


Quote:
> I am trying to create my own custom Tab Control, but I can't seem to make
it
> so you can switch tabs at design time (just like the tab control that
comes
> with VB) and have the controls inside each tab show and hide.  Right now I
> can only get my control to work as one container.  Help is appreciated.

> Thanks,
> Aaron



Sat, 04 Oct 2003 20:23:21 GMT  
 Custom Control: Container inside container...
Thanks for the help... but how do you know which controls inside the
UserControl Container belong to which tab?

Thanks,
Aaron


Quote:
> Setting a control's Visible property, at design time, has no effect on the
> control. If it did, you would lose controls on the form. The SSTab control
> also only has one container. It just moves all of the controls, which are
> not on the current tab, off screen to the left. When a tab becomes
current,
> it moves the controls back into place and moves the previous tab's
controls
> off screen. To hide the controls, just move them all the same distance to
> keep their relative positions intact (ie. move each control's Left -75000
to
> hide it and +75000 to show it, so all of the controls are in the correct
> place on the tab, when visible).

> Note: A 1600 x 1200 resolution has 24000 twips horizontally, so it's
> possible to have a control's right edge close to 24000. Resolutions of
2000
> x 1600 are becoming more popular every day, and that makes it possible to
> have a control's right edge close to 30000. You may want to consider using
> at least 75000 or more for your offset to ensure the entire control is off
> screen. SSTab currently uses 75000.

> To see SSTab's method:

> (1) Start a new project.
> (2) Add an SSTab control with 3 tabs.
> (3) Place a Label control on each tab
>     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2 respectively)
> (4) Copy this code to the form:

> Private Sub Form_Click()
>     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> End Sub

> Run the app and click on the form. Then switch tabs and click on the form
> again.

> Hope this helps,

> Rocky Clark (Kath-Rock Software)



> > I am trying to create my own custom Tab Control, but I can't seem to
make
> it
> > so you can switch tabs at design time (just like the tab control that
> comes
> > with VB) and have the controls inside each tab show and hide.  Right now
I
> > can only get my control to work as one container.  Help is appreciated.

> > Thanks,
> > Aaron



Sun, 05 Oct 2003 07:03:03 GMT  
 Custom Control: Container inside container...
Keep an internal array of controls and which tab they belong to. When the
user drops a control on the UserControl, just assign it to the current tab.

Hope this helps,

Rocky Clark (Kath-Rock Software)


Quote:
> Thanks for the help... but how do you know which controls inside the
> UserControl Container belong to which tab?

> Thanks,
> Aaron



> > Setting a control's Visible property, at design time, has no effect on
the
> > control. If it did, you would lose controls on the form. The SSTab
control
> > also only has one container. It just moves all of the controls, which
are
> > not on the current tab, off screen to the left. When a tab becomes
> current,
> > it moves the controls back into place and moves the previous tab's
> controls
> > off screen. To hide the controls, just move them all the same distance
to
> > keep their relative positions intact (ie. move each control's
Left -75000
> to
> > hide it and +75000 to show it, so all of the controls are in the correct
> > place on the tab, when visible).

> > Note: A 1600 x 1200 resolution has 24000 twips horizontally, so it's
> > possible to have a control's right edge close to 24000. Resolutions of
> 2000
> > x 1600 are becoming more popular every day, and that makes it possible
to
> > have a control's right edge close to 30000. You may want to consider
using
> > at least 75000 or more for your offset to ensure the entire control is
off
> > screen. SSTab currently uses 75000.

> > To see SSTab's method:

> > (1) Start a new project.
> > (2) Add an SSTab control with 3 tabs.
> > (3) Place a Label control on each tab
> >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2 respectively)
> > (4) Copy this code to the form:

> > Private Sub Form_Click()
> >     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> > End Sub

> > Run the app and click on the form. Then switch tabs and click on the
form
> > again.

> > Hope this helps,

> > Rocky Clark (Kath-Rock Software)



> > > I am trying to create my own custom Tab Control, but I can't seem to
> make
> > it
> > > so you can switch tabs at design time (just like the tab control that
> > comes
> > > with VB) and have the controls inside each tab show and hide.  Right
now
> I
> > > can only get my control to work as one container.  Help is
appreciated.

> > > Thanks,
> > > Aaron



Sun, 05 Oct 2003 08:25:11 GMT  
 Custom Control: Container inside container...
I am sorry, but I can't seem to figure out what event is triggered when a
control is dropped onto the form... also is there anyway to make my control
always is 'edit mode' during design time like VB's standard tab control?

Thanks again!
aaron


Quote:
> Keep an internal array of controls and which tab they belong to. When the
> user drops a control on the UserControl, just assign it to the current
tab.

> Hope this helps,

> Rocky Clark (Kath-Rock Software)



> > Thanks for the help... but how do you know which controls inside the
> > UserControl Container belong to which tab?

> > Thanks,
> > Aaron



> > > Setting a control's Visible property, at design time, has no effect on
> the
> > > control. If it did, you would lose controls on the form. The SSTab
> control
> > > also only has one container. It just moves all of the controls, which
> are
> > > not on the current tab, off screen to the left. When a tab becomes
> > current,
> > > it moves the controls back into place and moves the previous tab's
> > controls
> > > off screen. To hide the controls, just move them all the same distance
> to
> > > keep their relative positions intact (ie. move each control's
> Left -75000
> > to
> > > hide it and +75000 to show it, so all of the controls are in the
correct
> > > place on the tab, when visible).

> > > Note: A 1600 x 1200 resolution has 24000 twips horizontally, so it's
> > > possible to have a control's right edge close to 24000. Resolutions of
> > 2000
> > > x 1600 are becoming more popular every day, and that makes it possible
> to
> > > have a control's right edge close to 30000. You may want to consider
> using
> > > at least 75000 or more for your offset to ensure the entire control is
> off
> > > screen. SSTab currently uses 75000.

> > > To see SSTab's method:

> > > (1) Start a new project.
> > > (2) Add an SSTab control with 3 tabs.
> > > (3) Place a Label control on each tab
> > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2 respectively)
> > > (4) Copy this code to the form:

> > > Private Sub Form_Click()
> > >     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> > > End Sub

> > > Run the app and click on the form. Then switch tabs and click on the
> form
> > > again.

> > > Hope this helps,

> > > Rocky Clark (Kath-Rock Software)



> > > > I am trying to create my own custom Tab Control, but I can't seem to
> > make
> > > it
> > > > so you can switch tabs at design time (just like the tab control
that
> > > comes
> > > > with VB) and have the controls inside each tab show and hide.  Right
> now
> > I
> > > > can only get my control to work as one container.  Help is
> appreciated.

> > > > Thanks,
> > > > Aaron



Sun, 05 Oct 2003 12:46:43 GMT  
 Custom Control: Container inside container...
There is no event triggered when a control is dropped on your UserControl.
Microsoft suggests using a Timer control to find out if the
ContainedControls.Count has changed. As far as the being in "Edit" mode.
There is an "EditAtDesignTime" property, but this only enables editing if
the user right-clicks on the control and selects "Edit" from the menu. You
may have to get into subclassing to have the control always editable at
design time.

Rocky


Quote:
> I am sorry, but I can't seem to figure out what event is triggered when a
> control is dropped onto the form... also is there anyway to make my
control
> always is 'edit mode' during design time like VB's standard tab control?

> Thanks again!
> aaron



> > Keep an internal array of controls and which tab they belong to. When
the
> > user drops a control on the UserControl, just assign it to the current
> tab.

> > Hope this helps,

> > Rocky Clark (Kath-Rock Software)



> > > Thanks for the help... but how do you know which controls inside the
> > > UserControl Container belong to which tab?

> > > Thanks,
> > > Aaron



> > > > Setting a control's Visible property, at design time, has no effect
on
> > the
> > > > control. If it did, you would lose controls on the form. The SSTab
> > control
> > > > also only has one container. It just moves all of the controls,
which
> > are
> > > > not on the current tab, off screen to the left. When a tab becomes
> > > current,
> > > > it moves the controls back into place and moves the previous tab's
> > > controls
> > > > off screen. To hide the controls, just move them all the same
distance
> > to
> > > > keep their relative positions intact (ie. move each control's
> > Left -75000
> > > to
> > > > hide it and +75000 to show it, so all of the controls are in the
> correct
> > > > place on the tab, when visible).

> > > > Note: A 1600 x 1200 resolution has 24000 twips horizontally, so it's
> > > > possible to have a control's right edge close to 24000. Resolutions
of
> > > 2000
> > > > x 1600 are becoming more popular every day, and that makes it
possible
> > to
> > > > have a control's right edge close to 30000. You may want to consider
> > using
> > > > at least 75000 or more for your offset to ensure the entire control
is
> > off
> > > > screen. SSTab currently uses 75000.

> > > > To see SSTab's method:

> > > > (1) Start a new project.
> > > > (2) Add an SSTab control with 3 tabs.
> > > > (3) Place a Label control on each tab
> > > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2 respectively)
> > > > (4) Copy this code to the form:

> > > > Private Sub Form_Click()
> > > >     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> > > > End Sub

> > > > Run the app and click on the form. Then switch tabs and click on the
> > form
> > > > again.

> > > > Hope this helps,

> > > > Rocky Clark (Kath-Rock Software)



> > > > > I am trying to create my own custom Tab Control, but I can't seem
to
> > > make
> > > > it
> > > > > so you can switch tabs at design time (just like the tab control
> that
> > > > comes
> > > > > with VB) and have the controls inside each tab show and hide.
Right
> > now
> > > I
> > > > > can only get my control to work as one container.  Help is
> > appreciated.

> > > > > Thanks,
> > > > > Aaron



Sun, 05 Oct 2003 19:02:58 GMT  
 Custom Control: Container inside container...
Thanks again for your help... one last question and I think I will stop
bothering you :) ... I created a collection in the UserControl to keep track
of each control and what tab it belongs to, but when I execute the project
the collection that I had created at design time is wiped out at run-time.
Is there an easy way of saving this data other than using text files or a
database (i also tried the propbag property but could not get that to work
either)?  Thanks again!

aaron


Quote:
> There is no event triggered when a control is dropped on your UserControl.
> Microsoft suggests using a Timer control to find out if the
> ContainedControls.Count has changed. As far as the being in "Edit" mode.
> There is an "EditAtDesignTime" property, but this only enables editing if
> the user right-clicks on the control and selects "Edit" from the menu. You
> may have to get into subclassing to have the control always editable at
> design time.

> Rocky



> > I am sorry, but I can't seem to figure out what event is triggered when
a
> > control is dropped onto the form... also is there anyway to make my
> control
> > always is 'edit mode' during design time like VB's standard tab control?

> > Thanks again!
> > aaron



> > > Keep an internal array of controls and which tab they belong to. When
> the
> > > user drops a control on the UserControl, just assign it to the current
> > tab.

> > > Hope this helps,

> > > Rocky Clark (Kath-Rock Software)



> > > > Thanks for the help... but how do you know which controls inside the
> > > > UserControl Container belong to which tab?

> > > > Thanks,
> > > > Aaron



> > > > > Setting a control's Visible property, at design time, has no
effect
> on
> > > the
> > > > > control. If it did, you would lose controls on the form. The SSTab
> > > control
> > > > > also only has one container. It just moves all of the controls,
> which
> > > are
> > > > > not on the current tab, off screen to the left. When a tab becomes
> > > > current,
> > > > > it moves the controls back into place and moves the previous tab's
> > > > controls
> > > > > off screen. To hide the controls, just move them all the same
> distance
> > > to
> > > > > keep their relative positions intact (ie. move each control's
> > > Left -75000
> > > > to
> > > > > hide it and +75000 to show it, so all of the controls are in the
> > correct
> > > > > place on the tab, when visible).

> > > > > Note: A 1600 x 1200 resolution has 24000 twips horizontally, so
it's
> > > > > possible to have a control's right edge close to 24000.
Resolutions
> of
> > > > 2000
> > > > > x 1600 are becoming more popular every day, and that makes it
> possible
> > > to
> > > > > have a control's right edge close to 30000. You may want to
consider
> > > using
> > > > > at least 75000 or more for your offset to ensure the entire
control
> is
> > > off
> > > > > screen. SSTab currently uses 75000.

> > > > > To see SSTab's method:

> > > > > (1) Start a new project.
> > > > > (2) Add an SSTab control with 3 tabs.
> > > > > (3) Place a Label control on each tab
> > > > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2 respectively)
> > > > > (4) Copy this code to the form:

> > > > > Private Sub Form_Click()
> > > > >     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> > > > > End Sub

> > > > > Run the app and click on the form. Then switch tabs and click on
the
> > > form
> > > > > again.

> > > > > Hope this helps,

> > > > > Rocky Clark (Kath-Rock Software)



> > > > > > I am trying to create my own custom Tab Control, but I can't
seem
> to
> > > > make
> > > > > it
> > > > > > so you can switch tabs at design time (just like the tab control
> > that
> > > > > comes
> > > > > > with VB) and have the controls inside each tab show and hide.
> Right
> > > now
> > > > I
> > > > > > can only get my control to work as one container.  Help is
> > > appreciated.

> > > > > > Thanks,
> > > > > > Aaron



Mon, 06 Oct 2003 08:00:37 GMT  
 Custom Control: Container inside container...
There already is a collection of contained controls. called ContainedControls I think

--

Assistant Developer

iCode Systems

Quote:

> Thanks again for your help... one last question and I think I will stop
> bothering you :) ... I created a collection in the UserControl to keep track
> of each control and what tab it belongs to, but when I execute the project
> the collection that I had created at design time is wiped out at run-time.
> Is there an easy way of saving this data other than using text files or a
> database (i also tried the propbag property but could not get that to work
> either)?  Thanks again!

> aaron



> > There is no event triggered when a control is dropped on your UserControl.
> > Microsoft suggests using a Timer control to find out if the
> > ContainedControls.Count has changed. As far as the being in "Edit" mode.
> > There is an "EditAtDesignTime" property, but this only enables editing if
> > the user right-clicks on the control and selects "Edit" from the menu. You
> > may have to get into subclassing to have the control always editable at
> > design time.

> > Rocky



> > > I am sorry, but I can't seem to figure out what event is triggered when
> a
> > > control is dropped onto the form... also is there anyway to make my
> > control
> > > always is 'edit mode' during design time like VB's standard tab control?

> > > Thanks again!
> > > aaron



> > > > Keep an internal array of controls and which tab they belong to. When
> > the
> > > > user drops a control on the UserControl, just assign it to the current
> > > tab.

> > > > Hope this helps,

> > > > Rocky Clark (Kath-Rock Software)



> > > > > Thanks for the help... but how do you know which controls inside the

> > > > > UserControl Container belong to which tab?

> > > > > Thanks,
> > > > > Aaron



> > > > > > Setting a control's Visible property, at design time, has no
> effect
> > on
> > > > the
> > > > > > control. If it did, you would lose controls on the form. The SSTab
> > > > control
> > > > > > also only has one container. It just moves all of the controls,
> > which
> > > > are
> > > > > > not on the current tab, off screen to the left. When a tab becomes
> > > > > current,
> > > > > > it moves the controls back into place and moves the previous tab's
> > > > > controls
> > > > > > off screen. To hide the controls, just move them all the same
> > distance
> > > > to
> > > > > > keep their relative positions intact (ie. move each control's
> > > > Left -75000
> > > > > to
> > > > > > hide it and +75000 to show it, so all of the controls are in the
> > > correct
> > > > > > place on the tab, when visible).

> > > > > > Note: A 1600 x 1200 resolution has 24000 twips horizontally, so
> it's
> > > > > > possible to have a control's right edge close to 24000.
> Resolutions
> > of
> > > > > 2000
> > > > > > x 1600 are becoming more popular every day, and that makes it
> > possible
> > > > to
> > > > > > have a control's right edge close to 30000. You may want to
> consider
> > > > using
> > > > > > at least 75000 or more for your offset to ensure the entire
> control
> > is
> > > > off
> > > > > > screen. SSTab currently uses 75000.

> > > > > > To see SSTab's method:

> > > > > > (1) Start a new project.
> > > > > > (2) Add an SSTab control with 3 tabs.
> > > > > > (3) Place a Label control on each tab
> > > > > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2 respectively)
> > > > > > (4) Copy this code to the form:

> > > > > > Private Sub Form_Click()
> > > > > >     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> > > > > > End Sub

> > > > > > Run the app and click on the form. Then switch tabs and click on
> the
> > > > form
> > > > > > again.

> > > > > > Hope this helps,

> > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > I am trying to create my own custom Tab Control, but I can't
> seem
> > to
> > > > > make
> > > > > > it
> > > > > > > so you can switch tabs at design time (just like the tab control
> > > that
> > > > > > comes
> > > > > > > with VB) and have the controls inside each tab show and hide.
> > Right
> > > > now
> > > > > I
> > > > > > > can only get my control to work as one container.  Help is
> > > > appreciated.

> > > > > > > Thanks,
> > > > > > > Aaron



Mon, 06 Oct 2003 16:07:35 GMT  
 Custom Control: Container inside container...
I know there is a containercontrols collection, but my concern is when I
make an array to link the controls to the tab number they belong to... it
works fine at design time, but when I run it my array gets cleared.   Thanks
again!

aaron


Quote:
> I am trying to create my own custom Tab Control, but I can't seem to make
it
> so you can switch tabs at design time (just like the tab control that
comes
> with VB) and have the controls inside each tab show and hide.  Right now I
> can only get my control to work as one container.  Help is appreciated.

> Thanks,
> Aaron



Tue, 07 Oct 2003 02:02:31 GMT  
 Custom Control: Container inside container...
I know there is a containercontrols collection, but my  concern is when I
make an array to link the controls to the tab number they belong to... it
works fine at design time, but when I run it my array gets cleared.   Thanks
again!

aaron


Quote:
> There already is a collection of contained controls. called

ContainedControls I think
Quote:

> --

> Assistant Developer

> iCode Systems



Quote:
> > Thanks again for your help... one last question and I think I will stop
> > bothering you :) ... I created a collection in the UserControl to keep
track
> > of each control and what tab it belongs to, but when I execute the
project
> > the collection that I had created at design time is wiped out at
run-time.
> > Is there an easy way of saving this data other than using text files or
a
> > database (i also tried the propbag property but could not get that to
work
> > either)?  Thanks again!

> > aaron



> > > There is no event triggered when a control is dropped on your
UserControl.
> > > Microsoft suggests using a Timer control to find out if the
> > > ContainedControls.Count has changed. As far as the being in "Edit"
mode.
> > > There is an "EditAtDesignTime" property, but this only enables editing
if
> > > the user right-clicks on the control and selects "Edit" from the menu.
You
> > > may have to get into subclassing to have the control always editable
at
> > > design time.

> > > Rocky



> > > > I am sorry, but I can't seem to figure out what event is triggered
when
> > a
> > > > control is dropped onto the form... also is there anyway to make my
> > > control
> > > > always is 'edit mode' during design time like VB's standard tab
control?

> > > > Thanks again!
> > > > aaron



> > > > > Keep an internal array of controls and which tab they belong to.
When
> > > the
> > > > > user drops a control on the UserControl, just assign it to the
current
> > > > tab.

> > > > > Hope this helps,

> > > > > Rocky Clark (Kath-Rock Software)



> > > > > > Thanks for the help... but how do you know which controls inside
the

> > > > > > UserControl Container belong to which tab?

> > > > > > Thanks,
> > > > > > Aaron



> > > > > > > Setting a control's Visible property, at design time, has no
> > effect
> > > on
> > > > > the
> > > > > > > control. If it did, you would lose controls on the form. The
SSTab
> > > > > control
> > > > > > > also only has one container. It just moves all of the
controls,
> > > which
> > > > > are
> > > > > > > not on the current tab, off screen to the left. When a tab
becomes
> > > > > > current,
> > > > > > > it moves the controls back into place and moves the previous
tab's
> > > > > > controls
> > > > > > > off screen. To hide the controls, just move them all the same
> > > distance
> > > > > to
> > > > > > > keep their relative positions intact (ie. move each control's
> > > > > Left -75000
> > > > > > to
> > > > > > > hide it and +75000 to show it, so all of the controls are in
the
> > > > correct
> > > > > > > place on the tab, when visible).

> > > > > > > Note: A 1600 x 1200 resolution has 24000 twips horizontally,
so
> > it's
> > > > > > > possible to have a control's right edge close to 24000.
> > Resolutions
> > > of
> > > > > > 2000
> > > > > > > x 1600 are becoming more popular every day, and that makes it
> > > possible
> > > > > to
> > > > > > > have a control's right edge close to 30000. You may want to
> > consider
> > > > > using
> > > > > > > at least 75000 or more for your offset to ensure the entire
> > control
> > > is
> > > > > off
> > > > > > > screen. SSTab currently uses 75000.

> > > > > > > To see SSTab's method:

> > > > > > > (1) Start a new project.
> > > > > > > (2) Add an SSTab control with 3 tabs.
> > > > > > > (3) Place a Label control on each tab
> > > > > > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2
respectively)
> > > > > > > (4) Copy this code to the form:

> > > > > > > Private Sub Form_Click()
> > > > > > >     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> > > > > > > End Sub

> > > > > > > Run the app and click on the form. Then switch tabs and click
on
> > the
> > > > > form
> > > > > > > again.

> > > > > > > Hope this helps,

> > > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > > I am trying to create my own custom Tab Control, but I can't
> > seem
> > > to
> > > > > > make
> > > > > > > it
> > > > > > > > so you can switch tabs at design time (just like the tab
control
> > > > that
> > > > > > > comes
> > > > > > > > with VB) and have the controls inside each tab show and
hide.
> > > Right
> > > > > now
> > > > > > I
> > > > > > > > can only get my control to work as one container.  Help is
> > > > > appreciated.

> > > > > > > > Thanks,
> > > > > > > > Aaron



Tue, 07 Oct 2003 05:55:44 GMT  
 Custom Control: Container inside container...
Same with me, so I'm stumped as well

--

Assistant Developer

iCode Systems

Quote:

> I know there is a containercontrols collection, but my  concern is when I
> make an array to link the controls to the tab number they belong to... it
> works fine at design time, but when I run it my array gets cleared.   Thanks
> again!

> aaron



> > There already is a collection of contained controls. called
> ContainedControls I think

> > --

> > Assistant Developer

> > iCode Systems


> > > Thanks again for your help... one last question and I think I will stop
> > > bothering you :) ... I created a collection in the UserControl to keep
> track
> > > of each control and what tab it belongs to, but when I execute the
> project
> > > the collection that I had created at design time is wiped out at
> run-time.
> > > Is there an easy way of saving this data other than using text files or
> a
> > > database (i also tried the propbag property but could not get that to
> work
> > > either)?  Thanks again!

> > > aaron



> > > > There is no event triggered when a control is dropped on your
> UserControl.
> > > > Microsoft suggests using a Timer control to find out if the
> > > > ContainedControls.Count has changed. As far as the being in "Edit"
> mode.
> > > > There is an "EditAtDesignTime" property, but this only enables editing
> if
> > > > the user right-clicks on the control and selects "Edit" from the menu.
> You
> > > > may have to get into subclassing to have the control always editable
> at
> > > > design time.

> > > > Rocky



> > > > > I am sorry, but I can't seem to figure out what event is triggered
> when
> > > a
> > > > > control is dropped onto the form... also is there anyway to make my
> > > > control
> > > > > always is 'edit mode' during design time like VB's standard tab
> control?

> > > > > Thanks again!
> > > > > aaron



> > > > > > Keep an internal array of controls and which tab they belong to.
> When
> > > > the
> > > > > > user drops a control on the UserControl, just assign it to the
> current
> > > > > tab.

> > > > > > Hope this helps,

> > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > Thanks for the help... but how do you know which controls inside
> the

> > > > > > > UserControl Container belong to which tab?

> > > > > > > Thanks,
> > > > > > > Aaron



> > > > > > > > Setting a control's Visible property, at design time, has no
> > > effect
> > > > on
> > > > > > the
> > > > > > > > control. If it did, you would lose controls on the form. The
> SSTab
> > > > > > control
> > > > > > > > also only has one container. It just moves all of the
> controls,
> > > > which
> > > > > > are
> > > > > > > > not on the current tab, off screen to the left. When a tab
> becomes
> > > > > > > current,
> > > > > > > > it moves the controls back into place and moves the previous
> tab's
> > > > > > > controls
> > > > > > > > off screen. To hide the controls, just move them all the same
> > > > distance
> > > > > > to
> > > > > > > > keep their relative positions intact (ie. move each control's
> > > > > > Left -75000
> > > > > > > to
> > > > > > > > hide it and +75000 to show it, so all of the controls are in
> the
> > > > > correct
> > > > > > > > place on the tab, when visible).

> > > > > > > > Note: A 1600 x 1200 resolution has 24000 twips horizontally,
> so
> > > it's
> > > > > > > > possible to have a control's right edge close to 24000.
> > > Resolutions
> > > > of
> > > > > > > 2000
> > > > > > > > x 1600 are becoming more popular every day, and that makes it
> > > > possible
> > > > > > to
> > > > > > > > have a control's right edge close to 30000. You may want to
> > > consider
> > > > > > using
> > > > > > > > at least 75000 or more for your offset to ensure the entire
> > > control
> > > > is
> > > > > > off
> > > > > > > > screen. SSTab currently uses 75000.

> > > > > > > > To see SSTab's method:

> > > > > > > > (1) Start a new project.
> > > > > > > > (2) Add an SSTab control with 3 tabs.
> > > > > > > > (3) Place a Label control on each tab
> > > > > > > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2
> respectively)
> > > > > > > > (4) Copy this code to the form:

> > > > > > > > Private Sub Form_Click()
> > > > > > > >     Debug.Print Label1(0).Left, Label1(1).Left, Label1(2).Left
> > > > > > > > End Sub

> > > > > > > > Run the app and click on the form. Then switch tabs and click
> on
> > > the
> > > > > > form
> > > > > > > > again.

> > > > > > > > Hope this helps,

> > > > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > > > I am trying to create my own custom Tab Control, but I can't
> > > seem
> > > > to
> > > > > > > make
> > > > > > > > it
> > > > > > > > > so you can switch tabs at design time (just like the tab
> control
> > > > > that
> > > > > > > > comes
> > > > > > > > > with VB) and have the controls inside each tab show and
> hide.
> > > > Right
> > > > > > now
> > > > > > > I
> > > > > > > > > can only get my control to work as one container.  Help is
> > > > > > appreciated.

> > > > > > > > > Thanks,
> > > > > > > > > Aaron



Tue, 07 Oct 2003 17:53:35 GMT  
 Custom Control: Container inside container...
Aaron,

Persist the arrays to the PropertyBag. You should only need 2 arrays and a
count.

Here's an example to get you started:

Declarations section:
Private miCtrlCnt       As Integer
Private miCtrlTabs()    As Integer
Private msCtrlNames()   As String

Private Sub UserControl_Show()

'Just some garbage to fill the arrays here
Dim iIdx As Integer

    miCtrlCnt = 10
    ReDim miCtrlTabs(miCtrlCnt - 1)
    ReDim msCtrlNames(miCtrlCnt - 1)

    For iIdx = 0 To miCtrlCnt - 1
        miCtrlTabs(iIdx) = iIdx
        msCtrlNames(iIdx) = "SomeCtrl" _
            & CStr(iIdx)
    Next

    'This will force the WriteProperties to fire
    'when the form is unloaded or run and you
    'should call it whenever your controls change.
    PropertyChanged "ControlCount"

End Sub

'Load property values from storage
Private Sub UserControl_ReadProperties( _
    PropBag As PropertyBag)

Dim iIdx As Integer

    miCtrlCnt = PropBag.ReadProperty("ControlCount", 0)
    If miCtrlCnt > 0 Then
        ReDim miCtrlTabs(miCtrlCnt - 1)
        ReDim msCtrlNames(miCtrlCnt - 1)
        For iIdx = 0 To miCtrlCnt - 1
            miCtrlTabs(iIdx) = PropBag.ReadProperty( _
                "ControlTabs" & CStr(iIdx), 0)
            msCtrlNames(iIdx) = PropBag.ReadProperty( _
                "ControlNames" & CStr(iIdx), vbNullString)
        Next
    End If

End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties( _
    PropBag As PropertyBag)

Dim iIdx As Integer

    Call PropBag.WriteProperty("ControlCount", _
        miCtrlCnt, 0)
    For iIdx = 0 To miCtrlCnt - 1
        Call PropBag.WriteProperty("ControlTabs" _
            & CStr(iIdx), miCtrlTabs(iIdx), 0)
        Call PropBag.WriteProperty("ControlNames" _
            & CStr(iIdx), msCtrlNames(iIdx), vbNullString)
    Next

End Sub

I just tested this and it works perfectly.

Hope this helps,

Rocky Clark (Kath-Rock Software)


Quote:
> Same with me, so I'm stumped as well

> --

> Assistant Developer

> iCode Systems



Quote:
> > I know there is a containercontrols collection, but my  concern is when
I
> > make an array to link the controls to the tab number they belong to...
it
> > works fine at design time, but when I run it my array gets cleared.
Thanks
> > again!

> > aaron



> > > There already is a collection of contained controls. called
> > ContainedControls I think

> > > --

> > > Assistant Developer

> > > iCode Systems


> > > > Thanks again for your help... one last question and I think I will
stop
> > > > bothering you :) ... I created a collection in the UserControl to
keep
> > track
> > > > of each control and what tab it belongs to, but when I execute the
> > project
> > > > the collection that I had created at design time is wiped out at
> > run-time.
> > > > Is there an easy way of saving this data other than using text files
or
> > a
> > > > database (i also tried the propbag property but could not get that
to
> > work
> > > > either)?  Thanks again!

> > > > aaron



> > > > > There is no event triggered when a control is dropped on your
> > UserControl.
> > > > > Microsoft suggests using a Timer control to find out if the
> > > > > ContainedControls.Count has changed. As far as the being in "Edit"
> > mode.
> > > > > There is an "EditAtDesignTime" property, but this only enables edi
ting
> > if
> > > > > the user right-clicks on the control and selects "Edit" from the
menu.
> > You
> > > > > may have to get into subclassing to have the control always
editable
> > at
> > > > > design time.

> > > > > Rocky



> > > > > > I am sorry, but I can't seem to figure out what event is
triggered
> > when
> > > > a
> > > > > > control is dropped onto the form... also is there anyway to make
my
> > > > > control
> > > > > > always is 'edit mode' during design time like VB's standard tab
> > control?

> > > > > > Thanks again!
> > > > > > aaron



> > > > > > > Keep an internal array of controls and which tab they belong
to.
> > When
> > > > > the
> > > > > > > user drops a control on the UserControl, just assign it to the
> > current
> > > > > > tab.

> > > > > > > Hope this helps,

> > > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > > Thanks for the help... but how do you know which controls
inside
> > the

> > > > > > > > UserControl Container belong to which tab?

> > > > > > > > Thanks,
> > > > > > > > Aaron



> > > > > > > > > Setting a control's Visible property, at design time, has
no
> > > > effect
> > > > > on
> > > > > > > the
> > > > > > > > > control. If it did, you would lose controls on the form.
The
> > SSTab
> > > > > > > control
> > > > > > > > > also only has one container. It just moves all of the
> > controls,
> > > > > which
> > > > > > > are
> > > > > > > > > not on the current tab, off screen to the left. When a tab
> > becomes
> > > > > > > > current,
> > > > > > > > > it moves the controls back into place and moves the
previous
> > tab's
> > > > > > > > controls
> > > > > > > > > off screen. To hide the controls, just move them all the
same
> > > > > distance
> > > > > > > to
> > > > > > > > > keep their relative positions intact (ie. move each
control's
> > > > > > > Left -75000
> > > > > > > > to
> > > > > > > > > hide it and +75000 to show it, so all of the controls are
in
> > the
> > > > > > correct
> > > > > > > > > place on the tab, when visible).

> > > > > > > > > Note: A 1600 x 1200 resolution has 24000 twips
horizontally,
> > so
> > > > it's
> > > > > > > > > possible to have a control's right edge close to 24000.
> > > > Resolutions
> > > > > of
> > > > > > > > 2000
> > > > > > > > > x 1600 are becoming more popular every day, and that makes
it
> > > > > possible
> > > > > > > to
> > > > > > > > > have a control's right edge close to 30000. You may want
to
> > > > consider
> > > > > > > using
> > > > > > > > > at least 75000 or more for your offset to ensure the
entire
> > > > control
> > > > > is
> > > > > > > off
> > > > > > > > > screen. SSTab currently uses 75000.

> > > > > > > > > To see SSTab's method:

> > > > > > > > > (1) Start a new project.
> > > > > > > > > (2) Add an SSTab control with 3 tabs.
> > > > > > > > > (3) Place a Label control on each tab
> > > > > > > > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2
> > respectively)
> > > > > > > > > (4) Copy this code to the form:

> > > > > > > > > Private Sub Form_Click()
> > > > > > > > >     Debug.Print Label1(0).Left, Label1(1).Left,
Label1(2).Left
> > > > > > > > > End Sub

> > > > > > > > > Run the app and click on the form. Then switch tabs and
click
> > on
> > > > the
> > > > > > > form
> > > > > > > > > again.

> > > > > > > > > Hope this helps,

> > > > > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > > > > I am trying to create my own custom Tab Control, but I
can't
> > > > seem
> > > > > to
> > > > > > > > make
> > > > > > > > > it
> > > > > > > > > > so you can switch tabs at design time (just like the tab
> > control
> > > > > > that
> > > > > > > > > comes
> > > > > > > > > > with VB) and have the controls inside each tab show and
> > hide.
> > > > > Right
> > > > > > > now
> > > > > > > > I
> > > > > > > > > > can only get my control to work as one container.  Help
is
> > > > > > > appreciated.

> > > > > > > > > > Thanks,
> > > > > > > > > > Aaron



Wed, 08 Oct 2003 00:15:35 GMT  
 Custom Control: Container inside container...
Ok... thanks for all your help again, hopefully this will be my last post.
I have pretty much been able to put everything together using your input,
but there is one thing that is still bothering me:  How can I UNIQUELY
identify a control that is contained inside my custom tab control.  I was
using the Control.Name  & Control.index as my unique key, but I get a
problem when I change the name (or index) of a control using the properties
window while I am on a different tab than that control is on.  If there was
a unique number or key that identifies a control that never can change all
my problems would be solved (at first I thought I would use the hWnd
property but I realized that that changes).  I could probably survive with
out it, but I have come this far why not try to do it right?

Thanks Again!
aaron


Quote:
> Aaron,

> Persist the arrays to the PropertyBag. You should only need 2 arrays and a
> count.

> Here's an example to get you started:

> Declarations section:
> Private miCtrlCnt       As Integer
> Private miCtrlTabs()    As Integer
> Private msCtrlNames()   As String

> Private Sub UserControl_Show()

> 'Just some garbage to fill the arrays here
> Dim iIdx As Integer

>     miCtrlCnt = 10
>     ReDim miCtrlTabs(miCtrlCnt - 1)
>     ReDim msCtrlNames(miCtrlCnt - 1)

>     For iIdx = 0 To miCtrlCnt - 1
>         miCtrlTabs(iIdx) = iIdx
>         msCtrlNames(iIdx) = "SomeCtrl" _
>             & CStr(iIdx)
>     Next

>     'This will force the WriteProperties to fire
>     'when the form is unloaded or run and you
>     'should call it whenever your controls change.
>     PropertyChanged "ControlCount"

> End Sub

> 'Load property values from storage
> Private Sub UserControl_ReadProperties( _
>     PropBag As PropertyBag)

> Dim iIdx As Integer

>     miCtrlCnt = PropBag.ReadProperty("ControlCount", 0)
>     If miCtrlCnt > 0 Then
>         ReDim miCtrlTabs(miCtrlCnt - 1)
>         ReDim msCtrlNames(miCtrlCnt - 1)
>         For iIdx = 0 To miCtrlCnt - 1
>             miCtrlTabs(iIdx) = PropBag.ReadProperty( _
>                 "ControlTabs" & CStr(iIdx), 0)
>             msCtrlNames(iIdx) = PropBag.ReadProperty( _
>                 "ControlNames" & CStr(iIdx), vbNullString)
>         Next
>     End If

> End Sub

> 'Write property values to storage
> Private Sub UserControl_WriteProperties( _
>     PropBag As PropertyBag)

> Dim iIdx As Integer

>     Call PropBag.WriteProperty("ControlCount", _
>         miCtrlCnt, 0)
>     For iIdx = 0 To miCtrlCnt - 1
>         Call PropBag.WriteProperty("ControlTabs" _
>             & CStr(iIdx), miCtrlTabs(iIdx), 0)
>         Call PropBag.WriteProperty("ControlNames" _
>             & CStr(iIdx), msCtrlNames(iIdx), vbNullString)
>     Next

> End Sub

> I just tested this and it works perfectly.

> Hope this helps,

> Rocky Clark (Kath-Rock Software)



> > Same with me, so I'm stumped as well

> > --

> > Assistant Developer

> > iCode Systems


> > > I know there is a containercontrols collection, but my  concern is
when
> I
> > > make an array to link the controls to the tab number they belong to...
> it
> > > works fine at design time, but when I run it my array gets cleared.
> Thanks
> > > again!

> > > aaron



> > > > There already is a collection of contained controls. called
> > > ContainedControls I think

> > > > --

> > > > Assistant Developer

> > > > iCode Systems


> > > > > Thanks again for your help... one last question and I think I will
> stop
> > > > > bothering you :) ... I created a collection in the UserControl to
> keep
> > > track
> > > > > of each control and what tab it belongs to, but when I execute the
> > > project
> > > > > the collection that I had created at design time is wiped out at
> > > run-time.
> > > > > Is there an easy way of saving this data other than using text
files
> or
> > > a
> > > > > database (i also tried the propbag property but could not get that
> to
> > > work
> > > > > either)?  Thanks again!

> > > > > aaron



> > > > > > There is no event triggered when a control is dropped on your
> > > UserControl.
> > > > > > Microsoft suggests using a Timer control to find out if the
> > > > > > ContainedControls.Count has changed. As far as the being in
"Edit"
> > > mode.
> > > > > > There is an "EditAtDesignTime" property, but this only enables
edi
> ting
> > > if
> > > > > > the user right-clicks on the control and selects "Edit" from the
> menu.
> > > You
> > > > > > may have to get into subclassing to have the control always
> editable
> > > at
> > > > > > design time.

> > > > > > Rocky



> > > > > > > I am sorry, but I can't seem to figure out what event is
> triggered
> > > when
> > > > > a
> > > > > > > control is dropped onto the form... also is there anyway to
make
> my
> > > > > > control
> > > > > > > always is 'edit mode' during design time like VB's standard
tab
> > > control?

> > > > > > > Thanks again!
> > > > > > > aaron



> > > > > > > > Keep an internal array of controls and which tab they belong
> to.
> > > When
> > > > > > the
> > > > > > > > user drops a control on the UserControl, just assign it to
the
> > > current
> > > > > > > tab.

> > > > > > > > Hope this helps,

> > > > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > > > Thanks for the help... but how do you know which controls
> inside
> > > the

> > > > > > > > > UserControl Container belong to which tab?

> > > > > > > > > Thanks,
> > > > > > > > > Aaron



> > > > > > > > > > Setting a control's Visible property, at design time,
has
> no
> > > > > effect
> > > > > > on
> > > > > > > > the
> > > > > > > > > > control. If it did, you would lose controls on the form.
> The
> > > SSTab
> > > > > > > > control
> > > > > > > > > > also only has one container. It just moves all of the
> > > controls,
> > > > > > which
> > > > > > > > are
> > > > > > > > > > not on the current tab, off screen to the left. When a
tab
> > > becomes
> > > > > > > > > current,
> > > > > > > > > > it moves the controls back into place and moves the
> previous
> > > tab's
> > > > > > > > > controls
> > > > > > > > > > off screen. To hide the controls, just move them all the
> same
> > > > > > distance
> > > > > > > > to
> > > > > > > > > > keep their relative positions intact (ie. move each
> control's
> > > > > > > > Left -75000
> > > > > > > > > to
> > > > > > > > > > hide it and +75000 to show it, so all of the controls
are
> in
> > > the
> > > > > > > correct
> > > > > > > > > > place on the tab, when visible).

> > > > > > > > > > Note: A 1600 x 1200 resolution has 24000 twips
> horizontally,
> > > so
> > > > > it's
> > > > > > > > > > possible to have a control's right edge close to 24000.
> > > > > Resolutions
> > > > > > of
> > > > > > > > > 2000
> > > > > > > > > > x 1600 are becoming more popular every day, and that
makes
> it
> > > > > > possible
> > > > > > > > to
> > > > > > > > > > have a control's right edge close to 30000. You may want
> to
> > > > > consider
> > > > > > > > using
> > > > > > > > > > at least 75000 or more for your offset to ensure the
> entire
> > > > > control
> > > > > > is
> > > > > > > > off
> > > > > > > > > > screen. SSTab currently uses 75000.

> > > > > > > > > > To see SSTab's method:

> > > > > > > > > > (1) Start a new project.
> > > > > > > > > > (2) Add an SSTab control with 3 tabs.
> > > > > > > > > > (3) Place a Label control on each tab
> > > > > > > > > >     (Label1(0), Label1(1), Label1(2) on tabs 0, 1, 2
> > > respectively)
> > > > > > > > > > (4) Copy this code to the form:

> > > > > > > > > > Private Sub Form_Click()
> > > > > > > > > >     Debug.Print Label1(0).Left, Label1(1).Left,
> Label1(2).Left
> > > > > > > > > > End Sub

> > > > > > > > > > Run the app and click on the form. Then switch tabs and
> click
> > > on
> > > > > the
> > > > > > > > form
> > > > > > > > > > again.

> > > > > > > > > > Hope this helps,

> > > > > > > > > > Rocky Clark (Kath-Rock Software)



> > > > > > > > > > > I am trying to create my own custom Tab Control, but I
> can't
> > > > > seem
> > > > > > to
> > > > > > > > > make
> > > > > > > > > > it
> > > > > > > > > > > so you can switch tabs at

...

read more »



Thu, 09 Oct 2003 13:38:25 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Custom Control: Container inside container...

2. How do you control the location of a Word Document inside an Ole Container control

3. Moving Controls from Container to Container

4. Problem with using VB controls inside of VC++ OLE container

5. accessing the container a custom control is place on

6. Any way to make a custom control paint past edge of container

7. VB5 custom container control notification

8. Bug in custom control container?

9. vb5: Custom Control and Container Property

10. Any way to make a custom control paint past edge of container

11. getting an object(that's inside a container) label by using sender.text

12. Popup a custom Word menu from container

 

 
Powered by phpBB® Forum Software