Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Blacktown, Sydney, New South Wales, Australia
    Posts
    175
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Tab Control (AC2K)

    Does anyone know how I can change the Font Weight of the Caption of a Tab Control when it becomes the active tab.

    Put another way, when I click on a Tab, I want the format of the Caption to become Bold

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tab Control (AC2K)

    The font properties belong to the tab control itself, not to the individual pages, so I know of no way to do what you want to do. What's the purpose anyhow? The page becomes visible when you click on a tab, so why do you want to change the caption font?
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Blacktown, Sydney, New South Wales, Australia
    Posts
    175
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab Control (AC2K)

    Thanks for reply Charlotte. I guess I was looking for Window Dressing. It is no big deal, but was trying to make it blatantly obvious to user (at his request), which Tab was active. Will try and educate user with sledge hammer.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Tab Control (AC2K)

    That's the spirit.

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Tab Control (AC2K)

    As noted, there is no way to set font for individual pages on tab control. Another option (aside from sledgehammer) is to provide visual cue to indicate which tab is currently selected by toggling Page Picture property when tab is selected. Sample code:

    <pre>Private Sub TABCTL1_Change()

    With Me
    Select Case .TABCTL1
    Case 0 '1st tab
    .Page1.Picture = "C:ACCESSICONSPREVIEW.BMP"
    .Page2.Picture = ""
    Case 1 '2nd tab
    .Page2.Picture = "C:ACCESSICONSPREVIEW.BMP"
    .Page1.Picture = ""
    End Select
    End With

    End Sub</pre>

    You would need suitable small bitmap or icon to use for picture property. As shown, the .bmp or .ico path must be specified so these files would have to be available on target machine or from network location (though would not recommend latter, image will be slow to load). Assuming first tab is always selected when form opens, set picture property for first page in design mode, for 2nd & subsequent pages leave blank. You can use different bitmap images for different pages if desired.

    HTH

  6. #6
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Tab Control (AC2K)

    In further reply, here is variation of previous technique that will impersonate a bold caption when tab is selected. Create small bitmaps of tab captions, one bold and one regular font for each tab on tab control. I did this (very quickly) by typing caption text in a Word doc with "standard" grey background (same grey as tab control) & then using screen capture to create small bitmaps in Photo Editor. Revised code would look like this:

    <pre>Private Sub TABCTL1_Change()

    With Me
    Select Case .TabCtl1
    Case 0
    .Page1.Picture = "C:ACCESSICONSTAB1_BOLD.bmp"
    .Page2.Picture = "C:ACCESSICONSTAB2.bmp"
    Case 1
    .Page2.Picture = "C:ACCESSICONSTAB2_BOLD.bmp"
    .Page1.Picture = "C:ACCESSICONSTAB1.bmp"
    End Select
    End With

    End Sub</pre>

    Also, for this trick to work need to set Caption property for each Page to one or more blank spaces - if left blank, the generic control name ("Page1" or whatever) will appear as caption. Attached screen shot shows what this tab control looks like when form opened. When 2nd tab selected, "TAB 2" appears bold & "TAB 1" appears in regular font.

    This is sort of a goofy trick, I prefer using the toggle picture technique. But either method is less painful than a sledgehammer.

    PS: Though a sledgehammer may be in order when "users" come up with goofy requests.... <img src=/S/smash.gif border=0 alt=smash width=30 height=26>

    HTH
    Attached Images Attached Images

  7. #7
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Blacktown, Sydney, New South Wales, Australia
    Posts
    175
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab Control (AC2K)

    Mark, thats brilliant,
    You have hit the nail on the head (without sledgehammer).

    Programming would be so much simpler if we didn't have users.

Posting Permissions

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