UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Tab Control Events - Again, Access 2007    
 
   
Schizolocal
post May 19 2017, 04:56 PM
Post#1



Posts: 254
Joined: 22-March 06
From: St.Helena


I tried to research this topic but the only answer I seem to get to the question whether tab control OnClick events work is to use the OnChange event.

First, this is not an answer, although in many cases it suffices as a solution. But, sadly, not for me.

I want the tab control to react to a user click even if the page does NOT change. Why? Well, I am building a flexible configuration routine and when, in configuration mode, the user clicks on a page on the tab control, a special routine is called. I want this routine to be called even when the page stays the same. Is there any way that the tab control itself, or the active page of the tab control, can react to user clicks when the page doesn't change?

I can't seem to make any headway.

Stuart

--------------------
Opinions expressed that happen to coincide with
those of my employer, are mine. I work for myself.
Go to the top of the page
 
tina t
post May 19 2017, 05:14 PM
Post#2



Posts: 4,884
Joined: 11-November 10
From: SoCal, USA


the best way to see what works in your version of Access is to create a form, add a tab control to it. see if the tab page has a Click event available (if one page does, they all do). if it is available, add a couple controls to a tab page, like a textbox and a command button for example, then add some code to the tab page Click event procedure, such as a simple msgbox. then open the form in Form view and try clicking the page - if the msgbox pops up, you know it works. if it doesn't, try something else, like a different page event.

hth
tina

--------------------
"you can't take the sky from me"
Go to the top of the page
 
GroverParkGeorge
post May 19 2017, 08:21 PM
Post#3


UA Admin
Posts: 29,427
Joined: 20-June 02
From: Newcastle, WA


What have you tried so far? Did you actually put a tab control on a form and try to find and use a click event on it?

I ask because you seem to be saying you haven't been able to make it work. Is that correct?


--------------------
Go to the top of the page
 
GroverParkGeorge
post May 19 2017, 08:41 PM
Post#4


UA Admin
Posts: 29,427
Joined: 20-June 02
From: Newcastle, WA


This might help you understand.

Attached File  ClicakbleArea.png ( 12.33K )Number of downloads: 6


I added a red highlight box around the only area of a tab control which is "clickable", i.e. which causes the tab control's click event to fire.

Try it out for yourself. If that isn't what you need, you will have to take a different approach.

--------------------
Go to the top of the page
 
Schizolocal
post May 20 2017, 02:00 AM
Post#5



Posts: 254
Joined: 22-March 06
From: St.Helena


Thanks for all your replies

Yes, I have a tab control on a form (many, in fact), and I frequently use the OnChange event. But attempts to respond to clicks which don't change the page have resulted in failure.

If Grover's assertion that only the tab control itself responds to clicks (I don't doubt it, but I will be trying again with this in mind), then one has to wonder why the OnClick and OnDblClick events are defined at all for the individual pages.

I'll be re-doing my tests. In the end, however, I may have to resort to defining a separate button and test the currently active page number in its OnClick event.

Stuart

--------------------
Opinions expressed that happen to coincide with
those of my employer, are mine. I work for myself.
Go to the top of the page
 
cheekybuddha
post May 20 2017, 06:03 AM
Post#6


UtterAccess VIP
Posts: 8,979
Joined: 6-December 03
From: Telegraph Hill


Hi Stuart,

Each page on a tab control has a Click event.

However, this does not fire when you click on the actual tab portion of the page, only when you click on the page portion itself!

The tab control has a Click event.

However, this only fires when you click on the blank space to the right of the tabs, or if you click the very edge of a tab outside its 'label' area.

The only way to get an event to fire when you click on the main portion of an actual tab is when it changes!

You might be able to use API calls to work out where a mouse has been clicked on your form to achieve what you want but this will involve a lot of code (if it's at all possible) for what seems to be a minimal reward.

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
GroverParkGeorge
post May 20 2017, 07:23 AM
Post#7


UA Admin
Posts: 29,427
Joined: 20-June 02
From: Newcastle, WA


It makes sense that the tab itself and each individual page within a tab have their own Click events, does it not? If you click on one page, you want it to apply to that page, do you not?

Anyway, if you want to have the same event fire regardless of where the click event occurs, you can do that.

Create a standalone procedure, Sub or Function depending on whether you need to return a value from it. Call that procedure from the click event of the tab control and from each of the click events for all of its pages.

--------------------
Go to the top of the page
 
cheekybuddha
post May 20 2017, 07:28 AM
Post#8


UtterAccess VIP
Posts: 8,979
Joined: 6-December 03
From: Telegraph Hill


Hi George,

Can you get this to work when you click on the text of the current tab?

I couldn't. Only if I clicked the very edge around the 'label' on the tab portion.

shrug.gif

d

--------------------


Regards,

David Marten
Go to the top of the page
 
GroverParkGeorge
post May 20 2017, 08:03 AM
Post#9


UA Admin
Posts: 29,427
Joined: 20-June 02
From: Newcastle, WA


Actually, I didn't try that yet. Thanks for the reality check.

--------------------
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd May 2017 - 08:10 PM