Results 1 to 3 of 3

Thread: Crazy SSTAB problem

  1. #1

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Does anyone know how to move or change a control on a SSTab when the tab it is on is not visible? Kind crazy see what is happening is I wrote a little resize code that loops through all the controls and adjustes the size and placement by the screen resolution. (it just adjusts the top, left, font.size, and height, width of the form and all controls.) Everything works fine except when working with the SSTab it adjustes the controls on the tab that has focus or would have focus if the form was shown but the others disappear. What I have discovered is that when a control is on a tab that is not being shown it changes the left to -75000+the control's left, but if you change the left when it is like that then the tab won't change it back when the tab is brought in focus. Anyone know of a why around this? Any suggestions?

    Here is my code so far:
    Code:
    Public Enum scnResolutions
        res640x480
        res800x600
        res1024x768
        res1280x1024
        res1600x1200
    End Enum
    
    Public Sub Resize(def_Res As scnResolutions, frm As Form)
        Dim curwidth As Long
        Dim curheight As Long
        
        Dim mod_ht As Double
        Dim mod_wt As Double
        
        Dim mod_both As Double
        
        curheight = Screen.Height / 15
        curwidth = Screen.Width / 15
          
        Select Case def_Res
        Case res640x480
            mod_both = curwidth / 640
        Case res800x600
            mod_both = curwidth / 800
        Case res1024x768
            mod_both = curwidth / 1024
        Case res1280x1024
            mod_both = curwidth / 1280
        Case res1600x1200
            mod_both = curwidth / 1600
        End Select
        
        Dim ctrl As Control
        
        'Load frm
        Dim prev As Integer
        prev = frm.WindowState
        'change windowstate
        'can't resize in min or max
        frm.WindowState = 0
           
        'adjust form size
        frm.Width = frm.Width * mod_both
        frm.Height = frm.Height * mod_both
        
        'just for debugging
        frm.Caption = curwidth & "x" & curheight & " " & mod_both
           
        
        For Each ctrl In frm.Controls
            On Error Resume Next
            'adjust controls size
            ctrl.Width = ctrl.Width * mod_both
            ctrl.Height = ctrl.Height * mod_both
            'adjust font
            ctrl.Font.Size = ctrl.Font.Size * mod_both
            Printer.Print ctrl.Name & vbTab & ctrl.Left
            If ctrl.Container = "" Then
                'if not in a container adjust placement
                ctrl.Top = ctrl.Top * mod_both
                y = ctrl.Left * mod_both
                x = ctrl.Left
                If x > 0 Then
                ctrl.Left = ctrl.Left * mod_both
                Else
                ctrl.Left = (ctrl.Left + 75000) * mod_both
                End If
            End If
        Next
        Printer.EndDoc
        frm.WindowState = prev
    End Sub
    Last edited by Edneeis; Apr 12th, 2001 at 03:32 AM.

  2. #2

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    The Printer part is just some help debugging. I guess what might help is if I could get the control's container type instead of name. Does anyone know how to get the type of control from another control.container prop?

  3. #3

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well if anyone cares I figured it out so now it works with the sstab control and lines. Its not perfect but it works. just call it and pass the form and the resolution the form was developed in and you're in the mix. If you need it its here there are probably better ones out there but....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width