Tab page click event?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Clicking the caption of a tab page doesn't seem to fire the page's Click
event. Can someone confirm? Any workaround? I need to know what tab page
has focus so as to execute some code. Clicking the "body" of the page fires
the event but not clicking on the caption (the "tab" as most people would
consider it) doesn't. Thanks,

Chuck Flood
 
chuckflood said:
Clicking the caption of a tab page doesn't seem to fire the page's
Click event. Can someone confirm? Any workaround? I need to know
what tab page has focus so as to execute some code. Clicking the
"body" of the page fires the event but not clicking on the caption
(the "tab" as most people would consider it) doesn't. Thanks,

Use the Change event of the tab control itself (not the tab pages). The
Value property of the tab control is the Page Index of the current page.
 
Thanks -- that did it.

Dirk Goldgar said:
Use the Change event of the tab control itself (not the tab pages). The
Value property of the tab control is the Page Index of the current page.

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

(please reply to the newsgroup)
 
Is using the "On Change" event of the tab control, the only way to detect
when a user has clicked on a tab?

Using the On Change event presents other problems. While this event is
indeed triggered by the user changing the current tab, the event is also
triggered by any code somewhere else that changes the focus from one page to
another. Changing the focus from one page to another with the SetFocus
method causes any code in the On Change event to execute.

Is this a limitation that I need to work around, or am I missing something?
Thanks in advance.
Dan
 
Dan Wieland said:
Is using the "On Change" event of the tab control, the only way to detect
when a user has clicked on a tab?

Using the On Change event presents other problems. While this event is
indeed triggered by the user changing the current tab, the event is also
triggered by any code somewhere else that changes the focus from one page to
another. Changing the focus from one page to another with the SetFocus
method causes any code in the On Change event to execute.

Is this a limitation that I need to work around, or am I missing something?
Thanks in advance.
Dan

You could set your TabStyle to "None" and crate your own buttons for changing
pages. Then you would be able to use code in those buttons instead of the
Change of the TabControl. Button code would simply be...

Me.TabCpntrolName.Value = n

....where 'n' is the zero based page index that you want. Add whatever other
code you want to that button.

If you prefer the tab look then I'm afraid you're stuck.
 
Thanks Rick. That's a good idea.

Rick Brandt said:
You could set your TabStyle to "None" and crate your own buttons for changing
pages. Then you would be able to use code in those buttons instead of the
Change of the TabControl. Button code would simply be...

Me.TabCpntrolName.Value = n

....where 'n' is the zero based page index that you want. Add whatever other
code you want to that button.

If you prefer the tab look then I'm afraid you're stuck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top