+ Reply to Thread
Results 1 to 4 of 4

Shrinking list box

Hybrid View

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Shrinking list box


    Never seen this before.
    I have two option buttons, if I togle between the two, listbox1 height shrinks.
    It will go from 108.7 to finally togling between 11.8 and 12.6.



    Private Sub OptionButton1_Click()
    ListBox1.Height = "108.7" 'force list box height? (for testing)
    MsgBox ListBox1.Height 'for testing
        ListBox1.Clear
    
        TextBox11.Font = "Tahoma"
        SaveSetting "GdtFcfBuilder", "Variables", "sStdFont", OptionButton1.Value
        SaveSetting "GdtFcfBuilder", "Variables", "sIMSFont", OptionButton2.Value
    
        With ListBox1
            .Font.Name = "Tahoma"
            .Font.Size = "8"
            .AddItem "- (Straigtness)"
            .AddItem "Flat (Flatness)"
            .AddItem "Rnd (Roundness)"
            .AddItem "ProL (Profile Line)"
            .AddItem "ProS (Profile Surface)"
            .AddItem "Ang (Angularity)"
            .AddItem "// (Parallelism)"
            .AddItem "Per (Perpindicularity)"
            .AddItem "TP (True Position)"
            .AddItem "Con (concentricity)"
            .AddItem "Sym (Symetry)"
            .AddItem "CiRo (Circular Runout)"
            .AddItem "ToRo (Total Runout)"
        End With
    End Sub
    
    Private Sub OptionButton2_Click()
    ListBox1.Height = "108.7" 'force list box height? (for testing)
    MsgBox ListBox1.Height 'for testing
        ListBox1.Clear
    
        TextBox11.Font = "IMS"
        SaveSetting "GdtFcfBuilder", "Variables", "sStdFont", OptionButton1.Value
        SaveSetting "GdtFcfBuilder", "Variables", "sIMSFont", OptionButton2.Value
    
        With ListBox1
            .Font.Name = "IMS"
            .Font.Size = "8"
            .AddItem "³ (Straigtness)"
            .AddItem "ä (Flatness)"
            .AddItem "Î (Roundness)"
            .AddItem "ü (Profile Line)"
            .AddItem "æ (Profile Surface)"
            .AddItem "² (Angularity)"
            .AddItem "á (Parallelism)"
            .AddItem "ã (Perpindicularity)"
            .AddItem "û (True Position)"
            .AddItem "â (concentricity)"
            .AddItem "ÿ (Symetry)"
            .AddItem "ç (Circular Runout)"
            .AddItem "è (Total Runout)"
        End With
    End Sub
    Edit 1:
    I added code to force the height, but when togling you can actually see the height change.
    Is this due to changing Fonts?

    Edit 2:
    I set the Integral height to False, this seems to maintain the height but I cant scroll to the bottom of my list when option button2 is true.
    So I am back to square one. I removed the following code form both option buttons:
    ListBox1.Height = "108.7" 'force list box height? (for testing)
    MsgBox ListBox1.Height 'for testing
    Thus the listbox shrinks.

    Any hints, tips or examples are appreciated.
    Last edited by Rick_Stanich; 08-15-2009 at 11:37 AM.
    Regards

    Rick
    Win10, Office 365

  2. #2
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Re: Shrinking list box

    FYI
    By extending the listbox height beyond the list's length (Rows) the listbox quit shrinking.
    I think this is an issue between Tahoma and IMS font sizes.
    Font size 8 for Tahoma appears to be larger than font size 8 for IMS.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Shrinking list box

    Does it make any difference if you change the IntegralHeight property.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Re: Shrinking list box

    I set the Integral height to False, this seems to maintain the height but I cant scroll to the bottom of my list when option button2 is true.

    The only thing that prevents the shrinking is the list box height needs to be greater than the height of the rows for the list of items.
    I figured this out with trial and error.

    p.s.
    This wasn't a problem when I was using Checkboxes. I switched to optionboxes because some one said it would be better.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1