Tab Control issue

  • Thread starter Thread starter Perico
  • Start date Start date
P

Perico

When I click on the Page of a tab control, my click event
code does not fire. On the other hand, when I click on
the Section Detail of the page, that click event code does
fire. Is this a bug in Access 2000?

I tried over-laying the tab portion of the control with a
box control or command contral, as a work around, but you
can't do that.
 
-----Original Message-----
When I click on the Page of a tab control, my click event
code does not fire. On the other hand, when I click on
the Section Detail of the page, that click event code does
fire. Is this a bug in Access 2000?

I tried over-laying the tab portion of the control with a
box control or command contral, as a work around, but you
can't do that.
.
I've had the same frustration in Access 2002. I'd love to
set the text color differently on the active tab control
page. But nothing I've tried has worked either.

Does anybody have a solution (other than buying a third-
party tab control)?
 
Private Sub TabCtl0_Change()
MsgBox "You have selected tab " & Me.TabCtl0.Pages
(Me.TabCtl0.Value).Name
End Sub
 
The code supplied by MediaLint does little to answer the
questions. Yea, the code pops up a message box and tells
us which page we've clicked on But I can find no way to
indicate something useful on the tab control itself using
this code. To summarize:
- The click event for the tab control pages seems to be
dead. Is this a bug in Access?

- Is there anyway to add a border, colorize the page title
on the tab, bold it, whatever, to positively identify
which tab is in use (beside the obvious extension of the
page into the tab itself)?

- Does Access 2003 improve the functionality here?

John Loewen
 
The code supplied by MediaLint does little to answer the
questions. Yea, the code pops up a message box and tells
us which page we've clicked on But I can find no way to
indicate something useful on the tab control itself using
this code. To summarize:
- The click event for the tab control pages seems to be
dead. Is this a bug in Access?

I have no idea what you mean by this statement. The Click event fires
for tab *pages* just as it is supposed to -- if you click on the body of
the page, the Click event of the page fires. It does not fire if you
click the tab itself. But it's the Change event of the tab control
itself that will fire as you change pages.
- Is there anyway to add a border, colorize the page title
on the tab, bold it, whatever, to positively identify
which tab is in use (beside the obvious extension of the
page into the tab itself)?

Stephen Lebans may have something on his site, www.lebans.com , if the
normal design of the standard tab control isn't enough for you. Or you
could play around with setting the tab control's Style property to
"Buttons" instead of "Tabs". Or you could set the Style to "None" and
provide your own user-interface elements to switch tab pages and make it
clear which page you're on.
- Does Access 2003 improve the functionality here?

Dunno.
 
No, anonymous is corrent when he asks if the code is dead
for the click event on the tab itself. If you select the
tab itself, you see one set of events associated with it.
(Thats where the click event is "dead" - i.e. like a
vestigious organ!) If you select the detail section,
however, you see another set of events - that click event
works.

The problem is, the client wants an event to trigger when
the user clicks the TAB on the first page, not the page
itself. While Media Lint may not have answered the
question, the suggestion supplied worked perfectly.
Here's the code I used to finally put this one to bed:

Dim tbc As Control, pge As Page
' Return reference to tab control.
Set tbc = Me!TabCtl0
' Return reference to currently selected page.
Set pge = tbc.Pages(tbc.Value)
If pge.Caption = "Schools" Then MsgBox "Page 1 was clicked"

Thanks everyone.
-----Original Message-----


I have no idea what you mean by this statement. The Click event fires
for tab *pages* just as it is supposed to -- if you click on the body of
the page, the Click event of the page fires. It does not fire if you
click the tab itself. But it's the Change event of the tab control
itself that will fire as you change pages.


Stephen Lebans may have something on his site,
www.lebans.com , if the
 
No, anonymous is corrent when he asks if the code is dead
for the click event on the tab itself. If you select the
tab itself, you see one set of events associated with it.
(Thats where the click event is "dead" - i.e. like a
vestigious organ!)

On the contrary, that event most definitely does fire, but only as a
result of clicking the border of the tab control. I have yet to see any
use for it, so calling it "vestigial" isn't far off the mark, but it is
a functional organ.
 
Dirk Goldgar said:
On the contrary, that event most definitely does fire, but only as a
result of clicking the border of the tab control. I have yet to see any
use for it, so calling it "vestigial" isn't far off the mark, but it is
a functional organ.

I just tested this and I could click anywhere on the tab page to fire its
Click event if the TabControl was set to "Normal" background and I could
not get it to fire from anywhere (even on the border) if the background was
set to Transparent.
 
Rick Brandt said:
I just tested this and I could click anywhere on the tab page to fire
its Click event if the TabControl was set to "Normal" background and
I could not get it to fire from anywhere (even on the border) if the
background was set to Transparent.

The Click event of the *page* won't fire when you click the border,
whether the tab control is transparent or not. But the Click event of
the *tab control itself* does fire when you click the border, even if
the tab's BackStyle is Transparent.

The various participants in this thread seem to be talking somewhat at
cross-purposes. There are three "click event" issues being discussed, I
think:

1. When does the Click event of a tab control fire? Answer: when
you click the border of the tab control, but no when you click the tabs
themselves or the body of a tab page.

2. When does the Click event of a tab page fire? Answer: when you
click the body of the page, provided the tab's BackStyle property isn't
set to Transparent. (I didn't know that about the Back Style before --
thanks, Rick.)

3. When does the Click event of one of those little tabs fire?
Answer: never, because there is no such event. However, if clicking
that tab causes the tab control to change pages, the tab control's
Change event will fire.

Related followup questions, not about a Click event per se:

4. How do you know when a tab control changes pages? Answer: the
Change event of the tab control will fire. This will happen if the page
changes for whatever reason, even if it isn't in response to the user
clicking on a tab.

5. How do you know what page a tab control is currently displaying?
Answer: the Value property of the tab control is the PageIndex of the
page currently on view.
 
Dirk Goldgar said:
The Click event of the *page* won't fire when you click the border,
whether the tab control is transparent or not. But the Click event of
the *tab control itself* does fire when you click the border, even if
the tab's BackStyle is Transparent.

The various participants in this thread seem to be talking somewhat at
cross-purposes. There are three "click event" issues being discussed, I
think:

1. When does the Click event of a tab control fire? Answer: when
you click the border of the tab control, but no when you click the tabs
themselves or the body of a tab page.

2. When does the Click event of a tab page fire? Answer: when you
click the body of the page, provided the tab's BackStyle property isn't
set to Transparent. (I didn't know that about the Back Style before --
thanks, Rick.)

3. When does the Click event of one of those little tabs fire?
Answer: never, because there is no such event. However, if clicking
that tab causes the tab control to change pages, the tab control's
Change event will fire.

Related followup questions, not about a Click event per se:

4. How do you know when a tab control changes pages? Answer: the
Change event of the tab control will fire. This will happen if the page
changes for whatever reason, even if it isn't in response to the user
clicking on a tab.

5. How do you know what page a tab control is currently displaying?
Answer: the Value property of the tab control is the PageIndex of the
page currently on view.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Wow! This has been an interesting discussion. Thanks for the clarifications
finally, Dirk. Not that I like the facts - wish the tab control had a lot
more functionality. But its very useful as is and I'm using it in the apps I
build.

Experimenting after reading each of your replies, I found that the color of
the background of the tab control can't be controlled, which seems to make
the Back Style irrelevant. Neither can the color of the fonts on the tab
control be changed. And each tabbed page of the control has properties to
set the dimensions - Left, Top, Width, Height - but changing them affects
all the tabbed pages on the control, not just the one selected, so those are
basically irrelevant also (except they're needed somewhere to set those
dimensions once). Oh well - lots of interesting but useless facts. Maybe its
time to invest in a third party tab control if I really want to control all
those things.

John Loewen
 
JohnWL said:
Wow! This has been an interesting discussion. Thanks for the
clarifications finally, Dirk. Not that I like the facts - wish the
tab control had a lot more functionality. But its very useful as is
and I'm using it in the apps I build.

Experimenting after reading each of your replies, I found that the
color of the background of the tab control can't be controlled, which
seems to make the Back Style irrelevant. Neither can the color of the
fonts on the tab control be changed. And each tabbed page of the
control has properties to set the dimensions - Left, Top, Width,
Height - but changing them affects all the tabbed pages on the
control, not just the one selected, so those are basically irrelevant
also (except they're needed somewhere to set those dimensions once).
Oh well - lots of interesting but useless facts. Maybe its time to
invest in a third party tab control if I really want to control all
those things.

John Loewen

Stephen Lebans has done some work on extending the functions and
properties of the tab control. You may want to see what he's got on his
site, www.lebans.com .
 
Back
Top