Page 1 of 1

place frames in TabStrip

Posted: 04 Oct 2013, 20:16
by Andreas Vogt
Hi,
is there a sample how to place a frame on the tabstrip? I created a Frame for each Tab.
Andreas

Re: place frames in TabStrip

Posted: 05 Oct 2013, 10:57
by TiKu
Hi,

The TabStrip is a control container, i.e. you can place controls inside it like you can do with a PictureBox or Frame.
So, at first make sure that you place the frames inside the TabStrip and not just on top of it. Then you can connect each tab page with the frame window by using the hAssociatedWindow property:

Code: Select all

  Dim tsTab As TabStripTab
  
  Set tsTab = TabStrip1.Tabs.Add("Tab 1")
  tsTab.hAssociatedWindow = Frame1.hWnd
Now the TabStrip control will make sure that the correct frame is made visible when switching between the tab pages.

Regards
TiKu

Re: place frames in TabStrip

Posted: 05 Oct 2013, 13:56
by Andreas Vogt
Hi Timo,
thanks for help!
BTW: it also works when the frame is outside the tabstrip - but then you have to place it relative to the form.

Andreas

Re: place frames in TabStrip

Posted: 05 Oct 2013, 14:12
by TiKu
Andreas Vogt wrote:BTW: it also works when the frame is outside the tabstrip - but then you have to place it relative to the form.
Yes, you're right. For attaching the frames to the tabs, they don't need to be children of the tab control. But you won't get proper theming (with transparent frame background) if the frame controls are not children of the tab control. On the other hand, proper theming is something that works only with my ButtonControls library anyway. So if you use the VB6 frame control, it doesn't matter whether it's a child of the tab control or of the form.

Regards
TiKu

Re: place frames in TabStrip

Posted: 05 Oct 2013, 21:04
by Andreas Vogt
Hi,
I think I found something like a bug.
When I try to set the Tab-Placement it works for TB.TabPlacement = tpTop and TB.TabPlacement = tpBottom
But when I try "tpLeft" or "tpRight" I get the error 382: "Set wird zur Laufzeit nicht unterstützt"

Re: place frames in TabStrip

Posted: 05 Oct 2013, 22:31
by TiKu
It's not a bug. You really cannot change tab placement to one of these two values at runtime. Windows does not allow it.