Tab Control -- visible confusion |
Post Reply |
Author | |
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
Posted: 28 November 2009 at 6:57am |
I am using the Tab Control and getting unexpected results, so I have worked out what is happening.
If I put controls (eg textbox or label) onto a Tab Control (not using the separate TabPage control), then when I switch to a different Tab page those controls are not visible (as expected). If I read the .LEFT of those controls I find they have changed to .Left - 70000. ie the Tab control has hidden them off screen by altering the .Left position. That's OK (though I wish I'd known about it). Problem is when I set one of those controls to .Visible = False when I am on a different Tab page. When I change to the Tab page where the control is located, the Tab control makes the control visible again. If I read the .Visible it has been changed to True. Another problem. If I put a Line control on a Tab page, this remains visible on ALL the Tab Pages. (I guess this is because the Line doesn't have a .Left property, so Tab cannot hide it). I am sure I can find workarounds for all these little quirks, but first I am asking you if there is some common easy answer that I have missed. What do YOU do about these problems (or am I the only one to have noticed :-) |
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
gibra
Senior Member Joined: 31 October 2008 Location: Italy Status: Offline Points: 288 |
Post Options
Thanks(0)
|
TabControl isn't a TRUE container (like as TabStrip control) therefore, when you activate a different tab, controls will move to negative position
, to simulate Tab page behavior. Also, TabControl must set Visible=False to skip Tab key action, otherwise the user don't see really what control has Focus.
It's much better to use a TabPage as container ( for each Tab ) so TabControl must move only one control at time (TabPage) instead to move all controls for this Tab. This improve performances, of course.
In this way you avoid problem with Visible property, because TabControl set Visible=False only for TabPage, NOT for controls contained, so you can set control propreties as you want.
|
|
gibra
CJ SuiteControl v: 13.x to 19.x Windows 10 64bit VS2019 - VB6.0 SP6 <a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8 |
|
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
|
Many thanks. That was a very helpful answer.
|
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |