all groups > vb.net controls > june 2007 >
You're in the

vb.net controls

group:

Tab control


Tab control Luke R
6/29/2007 12:00:00 AM
vb.net controls: I have a tab page with 2 tabs on my form. The controls on tab A return a
visible property of False if tab B is currently selected even though the
Control.Visible property for each control has been explicitly set to True.

Is this how its supposed to work? Why does it go ahead and modify the
properties of every control on my tab page? That ridiculous.

How am I supposed to know, if the control is located on the non-active tab,
whether it is going to be visible when the user clicks back to it? If they
all return false then how am I supposed to know which ones are going to be
visible when the tab is selected again?

If you're going to say "Well the control isn't visible is it?" then why
doesn't it set the .Visible property to False if I have another window
covering the control? Or if the control is located outside the bounds of the
screen?

The other thing that I find stupid about the tab control is why it defaults
the backcolor of each tab to Transparent? If you change them all to Control,
and you add another tab, then its sets every single tabpage in the
tabcontrol back to Transparent. Stupid thing.
Re: Tab control Jan Hyde (VB MVP)
7/2/2007 12:00:00 AM
"Luke R" <dont@spam.me>'s wild thoughts were released on
Fri, 29 Jun 2007 14:43:52 +1200 bearing the following fruit:

[quoted text, click to view]

It probably doesn't modify the property. If a control has
it's visible property set to true but it's container's
visible property is set to false then then the control will
report it's visible property as false.

Besides, it's not visible so why worry?


[quoted text, click to view]

Why do you need to know?

[quoted text, click to view]

That's a different scenario and the control is still
accessible even if it is off screen.

J

[quoted text, click to view]


--
Jan Hyde

Re: Tab control Luke R
7/3/2007 12:00:00 AM
[quoted text, click to view]
What difference does it make really? It returns false when it is actually
set to true. It returns the wrong value.

[quoted text, click to view]
I think the question should be, why should i be prevented from knowing?
Doing it the way it currently stands has limitations, namely that you do not
know the true visible property of each control in the container until that
container is made visible.

Doing it the other way (which would seem more logical to me) has no
limitations. You could establish whether the controls were available on the
screen by testing for Tab.Selected, and you could establish which controls
in the non-active tab are really visible or not by looking at their visible
property. You can have it both ways, instead of just one way.

In answer to your question; I need to know because I perform actions
depending on which controls are visible, and when a tab is not selected, all
the controls say false when really .Visible has been set to true.


[quoted text, click to view]
Re: Tab control Jan Hyde (VB MVP)
7/3/2007 12:00:00 AM
"Luke R" <dont@spam.me>'s wild thoughts were released on
Tue, 3 Jul 2007 12:53:19 +1200 bearing the following fruit:

[quoted text, click to view]

It returns the correct value, just depends on you point of
view I guess ;-)

[quoted text, click to view]

No the question is why do you want to know. I can't help
unless I know. It may be we can offer you alernative methods
to achieve your goal.

[quoted text, click to view]

Can you give me any examples?

J

[quoted text, click to view]

--
Jan Hyde

Re: Tab control Luke R
7/4/2007 12:00:00 AM
[quoted text, click to view]

I appreciate your offer for assistance, but I have had to rewrite sections
of my code, and my issue is already solved. I just think its really poor
that the tab control works this way.

One thing you can help me with is how do I stop the tab control from
defaulting the backcolor of each tab to Transparent? If I go and set them
all manually to Control, then each time I add or remove a new tab, every
single tab page in the collection goes back to Transparent. Very annoying.



[quoted text, click to view]
Re: Tab control Mick Doherty
7/4/2007 12:00:00 AM
[quoted text, click to view]

Set the TabPages UseVisualStyleBackColor property to false.

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html



AddThis Social Bookmark Button