Discussion:
VB6, Farpoint's vaTabPro - Finding tab a control appears upon.
(too old to reply)
m***@gmail.com
2007-02-01 17:24:00 UTC
Permalink
Hi there...

We're using VB6 and FarPoint's vaTabPro control. Basically, we have a
number of controls on a number of tabs (assigned at design time), and
an Update button. One of the consequences of pushing the update button
is that some code runs checking mandatory entries, and if it finds one
that is not filled in we present a messagebox informing the user of
the problem, and set focus back to the control in question... Because
the control might be on a differet tab to the one currently being
displayed, this means that we need to know the tab each code is on so
we can make it the Active Tab before calling .SetFocus.

Our current solution is to store strings in the resource file
detailing which tabs the various controls can be found on, but
everyone once in a while someone sticks a new control on the tab
control, and forgets to update the resource file - which is annoying,
and leads to bug reports when the control doesn't receive focus. So,
I'd like to move away from this idea...

What I want to do is write a function that accepts, as arguments, both
a vaTabPro control and then one of the input controls - then
programatically determines which tab (if any) the control is on. In
doing this, it shouldn't update the screen at all - we don't want to
cycle through making every tab visible, as this would look bad...

Any ideas?

Martin.
Lee Weiner
2007-02-01 22:32:07 UTC
Permalink
Post by m***@gmail.com
What I want to do is write a function that accepts, as arguments, both
a vaTabPro control and then one of the input controls - then
programatically determines which tab (if any) the control is on. In
doing this, it shouldn't update the screen at all - we don't want to
cycle through making every tab visible, as this would look bad...
One way I've handled this in the past is to put an indicator of the parent tab
in the input control's Tag property.

Lee Weiner
lee AT leeweiner DOT org
m***@gmail.com
2007-02-02 10:10:52 UTC
Permalink
Post by Lee Weiner
One way I've handled this in the past is to put an indicator of the parent tab
in the input control's Tag property.
Lee Weiner
Cheers Lee...

Unfortunately that's not really an possibility for us - partly because
on some of the controls we are using the tag property to achieve other
things... The other problem is that we would be just as dependent on
remembering to populate the tag property as we currently are on
remembering to enter the information in the resource file.

What I'm looking for is achieving this relying on nothing more than
the fact that a control is on a tab. I'm beginning to wonder about
attacking the control using the windows API - backtracking from the
control's window looking at parent windows until I arrive at the hWnd
for the tab control, then looking at "1 down" to get the individual
tab handle, checking that window's text to (hopefully) arrive at the
tabcaption, and then cycling through the tabs to find which one has
that handle.

As you can see, I like pain...

Martin.
m***@gmail.com
2007-02-02 11:58:40 UTC
Permalink
Post by m***@gmail.com
Post by Lee Weiner
One way I've handled this in the past is to put an indicator of the parent tab
in the input control's Tag property.
Lee Weiner
Cheers Lee...
Unfortunately that's not really an possibility for us - partly because
on some of the controls we are using the tag property to achieve other
things... The other problem is that we would be just as dependent on
remembering to populate the tag property as we currently are on
remembering to enter the information in the resource file.
What I'm looking for is achieving this relying on nothing more than
the fact that a control is on a tab. I'm beginning to wonder about
attacking the control using the windows API - backtracking from the
control's window looking at parent windows until I arrive at the hWnd
for the tab control, then looking at "1 down" to get the individual
tab handle, checking that window's text to (hopefully) arrive at the
tabcaption, and then cycling through the tabs to find which one has
that handle.
As you can see, I like pain...
Martin.
10 minutes with SPY++ suggest this is not an option either...

Loading...