No Resizing SSTab-Contained Controls from a UserControl 
Author Message
 No Resizing SSTab-Contained Controls from a UserControl

I am building a Resizer ActiveX Control. When placed on a form, it will
respond to the form's resizer event, and correctly resize most controls in
step with the form resize.

I am seeing an anomoly, however,  with the SSTab control. After the resize,
all controls on non-selected tabs appear on the 'selected tab' page, as well
as correctly appearing on their own tab pages. The newly created instances
of the
commandbuttons(I used for test), show the same hWnd value as the correct
ones,
so something screwy seems to be going on with SSTab.

Does anyone see something I'm doing incorrectly, or can you suggest a
different way to obtain the resize without confusing the SSTab control?

Regards,

Mike Pryor

==============
My UserControl code is similar to below:
Private Sub ParentForm_Resize()
    HeightRatio = ResizeRatio(BaselineParentHeight,
UserControl.Parent.Height)
    WidthRatio = ResizeRatio(BaselineParentWidth, UserControl.Parent.Width
      'ControlSizeArray() contains baseline control dimensions obtained at
form load.
     For Each cnt In ParentForm.Controls
        Idx = Idx + 1
        Select Case True
        Case TypeOf cnt Is CommandButton ' I use Command Buttons in my test
form.
            cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
            cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
            cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
            cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
        Case TypeOf cnt Is DriveListBox Or _
             TypeOf cnt Is ComboBox
                cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
                cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
        Case Else '
            cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
            cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
            cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
            cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
        End Select
    Next
End Sub
================================================



Thu, 23 Oct 2003 08:28:43 GMT  
 No Resizing SSTab-Contained Controls from a UserControl
The SSTab control is a single container. The controls are moved in and out
of view, depending on which tab is selected. The SSTab moves each control
75,000 twips to the left for all controls which are not on the current tab.
Your code just moved them all back into the visible area. You'll need to
calculate where to move the controls, based on their current position,
instead of basing it on the SSTab "Visible" area.

Calculate the Left, Top, Width and Height, before moving the control. Then:

    If Control.Left < 0 Then
        Left = Left - 75000.
    End If
    Control.Move Left, Top, Width, Height

Hope this helps,

Rocky Clark (Kath-Rock Software)


Quote:
> I am building a Resizer ActiveX Control. When placed on a form, it will
> respond to the form's resizer event, and correctly resize most controls in
> step with the form resize.

> I am seeing an anomoly, however,  with the SSTab control. After the
resize,
> all controls on non-selected tabs appear on the 'selected tab' page, as
well
> as correctly appearing on their own tab pages. The newly created instances
> of the
> commandbuttons(I used for test), show the same hWnd value as the correct
> ones,
> so something screwy seems to be going on with SSTab.

> Does anyone see something I'm doing incorrectly, or can you suggest a
> different way to obtain the resize without confusing the SSTab control?

> Regards,

> Mike Pryor

> ==============
> My UserControl code is similar to below:
> Private Sub ParentForm_Resize()
>     HeightRatio = ResizeRatio(BaselineParentHeight,
> UserControl.Parent.Height)
>     WidthRatio = ResizeRatio(BaselineParentWidth, UserControl.Parent.Width
>       'ControlSizeArray() contains baseline control dimensions obtained at
> form load.
>      For Each cnt In ParentForm.Controls
>         Idx = Idx + 1
>         Select Case True
>         Case TypeOf cnt Is CommandButton ' I use Command Buttons in my
test
> form.
>             cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
>             cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
>             cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
>             cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
>         Case TypeOf cnt Is DriveListBox Or _
>              TypeOf cnt Is ComboBox
>                 cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
>                 cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
>         Case Else '
>             cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
>             cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
>             cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
>             cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
>         End Select
>     Next
> End Sub
> ================================================



Thu, 23 Oct 2003 19:12:23 GMT  
 No Resizing SSTab-Contained Controls from a UserControl
Thanks,

That's the kind of clue I needed. I'll post again when I successfully
complete it.

Regards,

Mike Pryor

Quote:
> The SSTab control is a single container. The controls are moved in and out
> of view, depending on which tab is selected. The SSTab moves each control
> 75,000 twips to the left for all controls which are not on the current
tab.
> Your code just moved them all back into the visible area. You'll need to
> calculate where to move the controls, based on their current position,
> instead of basing it on the SSTab "Visible" area.

> Calculate the Left, Top, Width and Height, before moving the control.
Then:

>     If Control.Left < 0 Then
>         Left = Left - 75000.
>     End If
>     Control.Move Left, Top, Width, Height

> Hope this helps,

> Rocky Clark (Kath-Rock Software)



> > I am building a Resizer ActiveX Control. When placed on a form, it will
> > respond to the form's resizer event, and correctly resize most controls
in
> > step with the form resize.

> > I am seeing an anomoly, however,  with the SSTab control. After the
> resize,
> > all controls on non-selected tabs appear on the 'selected tab' page, as
> well
> > as correctly appearing on their own tab pages. The newly created
instances
> > of the
> > commandbuttons(I used for test), show the same hWnd value as the correct
> > ones,
> > so something screwy seems to be going on with SSTab.

> > Does anyone see something I'm doing incorrectly, or can you suggest a
> > different way to obtain the resize without confusing the SSTab control?

> > Regards,

> > Mike Pryor

> > ==============
> > My UserControl code is similar to below:
> > Private Sub ParentForm_Resize()
> >     HeightRatio = ResizeRatio(BaselineParentHeight,
> > UserControl.Parent.Height)
> >     WidthRatio = ResizeRatio(BaselineParentWidth,

UserControl.Parent.Width

- Show quoted text -

Quote:
> >       'ControlSizeArray() contains baseline control dimensions obtained
at
> > form load.
> >      For Each cnt In ParentForm.Controls
> >         Idx = Idx + 1
> >         Select Case True
> >         Case TypeOf cnt Is CommandButton ' I use Command Buttons in my
> test
> > form.
> >             cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
> >             cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
> >             cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
> >             cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
> >         Case TypeOf cnt Is DriveListBox Or _
> >              TypeOf cnt Is ComboBox
> >                 cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
> >                 cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
> >         Case Else '
> >             cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
> >             cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
> >             cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
> >             cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
> >         End Select
> >     Next
> > End Sub
> > ================================================



Sat, 25 Oct 2003 00:10:28 GMT  
 No Resizing SSTab-Contained Controls from a UserControl
Yes, it worked. Thanks a lot, Rocky.

Mike Pryor


Quote:
> The SSTab control is a single container. The controls are moved in and out
> of view, depending on which tab is selected. The SSTab moves each control
> 75,000 twips to the left for all controls which are not on the current
tab.
> Your code just moved them all back into the visible area. You'll need to
> calculate where to move the controls, based on their current position,
> instead of basing it on the SSTab "Visible" area.

> Calculate the Left, Top, Width and Height, before moving the control.
Then:

>     If Control.Left < 0 Then
>         Left = Left - 75000.
>     End If
>     Control.Move Left, Top, Width, Height

> Hope this helps,

> Rocky Clark (Kath-Rock Software)



> > I am building a Resizer ActiveX Control. When placed on a form, it will
> > respond to the form's resizer event, and correctly resize most controls
in
> > step with the form resize.

> > I am seeing an anomoly, however,  with the SSTab control. After the
> resize,
> > all controls on non-selected tabs appear on the 'selected tab' page, as
> well
> > as correctly appearing on their own tab pages. The newly created
instances
> > of the
> > commandbuttons(I used for test), show the same hWnd value as the correct
> > ones,
> > so something screwy seems to be going on with SSTab.

> > Does anyone see something I'm doing incorrectly, or can you suggest a
> > different way to obtain the resize without confusing the SSTab control?

> > Regards,

> > Mike Pryor

> > ==============
> > My UserControl code is similar to below:
> > Private Sub ParentForm_Resize()
> >     HeightRatio = ResizeRatio(BaselineParentHeight,
> > UserControl.Parent.Height)
> >     WidthRatio = ResizeRatio(BaselineParentWidth,

UserControl.Parent.Width

- Show quoted text -

Quote:
> >       'ControlSizeArray() contains baseline control dimensions obtained
at
> > form load.
> >      For Each cnt In ParentForm.Controls
> >         Idx = Idx + 1
> >         Select Case True
> >         Case TypeOf cnt Is CommandButton ' I use Command Buttons in my
> test
> > form.
> >             cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
> >             cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
> >             cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
> >             cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
> >         Case TypeOf cnt Is DriveListBox Or _
> >              TypeOf cnt Is ComboBox
> >                 cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
> >                 cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
> >         Case Else '
> >             cnt.Height = Int(ControlSizeArray(Idx).Height * HeightRatio)
> >             cnt.Width = Int(ControlSizeArray(Idx).Width * WidthRatio)
> >             cnt.Top = Int(ControlSizeArray(Idx).Top * HeightRatio)
> >             cnt.Left = Int(ControlSizeArray(Idx).Left * WidthRatio)
> >         End Select
> >     Next
> > End Sub
> > ================================================



Sat, 25 Oct 2003 13:32:20 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. resizing forms containing the sstab control

2. Usercontrol resize when label control resizes

3. Resizing controls on SSTab causes some controls to always appear on top

4. Printing a Picturebox with Usercontrol childern containing Shape control

5. Setting TAB order in a form which contains an SSTAB control

6. SSTAB - determining the tab that contains a control

7. Question - How to resize controls contained in a tab (VB4)

8. SSTab control and resizing a form

9. sstab control - resizing during runtime problem

10. Resizing SSTab makes controls superimpose over each other!

11. Urgent! How auto resize SSTAB control

12. Resizing the controls in sstab

 

 
Powered by phpBB® Forum Software