Welcome! Log In Create A New Profile

Advanced

Dynamic Tab control

Posted by DarrenF 
DarrenF
Dynamic Tab control
May 07, 2009 02:17AM
Hi all,

Is it possible to add tabs to a Tab Control dynamically? Can't find anything in the help...

I'd like to dynamically add a new tab to a Tab Control based on the contents of a HF file - one tab per record.

Is it possible - any ideas?

Thanks in advance...
DarrenF
Re: Dynamic Tab control
May 07, 2009 03:12PM
Can assume it's not possible? :confused:
Al
Re: Dynamic Tab control
May 07, 2009 04:10PM
Hello Darren

There have been a few posts requesting this feature over the years. It appears that it is not possible and the best solution put forward is to prebuild the tab control to have as many tabs as could possibly be required and to hide and unhide the pre-existing tabs as required.
The hyper file record could contain the index number of the tab, its caption and its visible state and so manage the tabs quite easily.

The other problem I think you will come up against is assigning controls to the tab, unless they also pre-exist on each tab. To the best of my knowledge, although you can create controls by cloning them, there is no way to programatically then assign the cloned control to a tab.

You could construct something that functioned like a tab control using a sidebar control on the left of the screen with other controls on planes on the right hand side. The items in the sidebar could function as the tab headings. The CRM sample is a nice example of a sidebar in operation.


Regards
Al
Fabrice Harari.pcs.crosspost
Re: Dynamic Tab control
May 07, 2009 04:38PM
hi Darren

No it's not... You can have a tab control with a big number of tabs and
make them visible when needed, but if you need and illimited number of
tabs, you have to fake it...

One static or image for the background, buttons for the tabs buttons,
and you fill dynamically:
- what need to be displayed on the 'active tab'
- the label of the buttons

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on [www.fabriceharari.com]

DarrenF wrote:
> Hi all,
> Is it possible to add tabs to a Tab Control dynamically? Can't find anything in the help...
> I'd like to dynamically add a new tab to a Tab Control based on the contents of a HF file - one tab per record.
> Is it possible - any ideas?
> Thanks in advance...
>
Message forwarded from pcsoft.us.windev
Milton
Re: Dynamic Tab control
May 07, 2009 10:21PM
Hi Darren,

I agree with the other posts here as I investigated this when writing an application containing multiple TABS. I set up the tabs and then declared them all as not visible. Then I had a table called "PANES" in which I allowed the program administrator to identify which tabs should be visible by selecting TRUE or FALSE in a form which populated the PANES table.

The tabs themselves had to be pre-populated with all of their controls. However, the buttons appearing on the TAB were also declared invisible unless the button description, which was held in another table, was greater than " ". The code for displaying the TABS is below the image.

HTH

Milton



Tab1=1

HOpen(PanesInfo,"",hORead)
HReadFirst(PanesInfo,PaneNumber)
Tab1[1]..Caption=PanesInfo.PaneCaption
IF PanesInfo.PaneVisible=False THEN
Tab1[1]..Visible=False
ELSE
Tab1[1]..Visible=True
END
HReadNext(PanesInfo,PaneNumber)
Tab1[2]..Caption=PanesInfo.PaneCaption
IF PanesInfo.PaneVisible=False THEN
Tab1[2]..Visible=False
ELSE
Tab1[2]..Visible=True
END
HReadNext(PanesInfo,PaneNumber)
Tab1[3]..Caption=PanesInfo.PaneCaption
IF PanesInfo.PaneVisible=False THEN
Tab1[3]..Visible=False
ELSE
Tab1[3]..Visible=True
END
HReadNext(PanesInfo,PaneNumber)
Tab1[4]..Caption=PanesInfo.PaneCaption
IF PanesInfo.PaneVisible=False THEN
Tab1[4]..Visible=False
ELSE
Tab1[4]..Visible=True
END
HReadNext(PanesInfo,PaneNumber)
Tab1[5]..Caption=PanesInfo.PaneCaption
IF PanesInfo.PaneVisible=False THEN
Tab1[5]..Visible=False
ELSE
Tab1[5]..Visible=True
END
Piet van Zanten
Re: Dynamic Tab control
May 07, 2009 11:48PM
Hi Darren,

As an addition I think it's possible to use planes to emulate a tab.
You can clone controls and then assign them to a plane by programming.
Use some graphics to get a tab-like look. (perhaps use the windev tab images on buttons?) Takes some extra programming, but doable.

Regards,
Piet.

DarrenF
Re: Dynamic Tab control
May 08, 2009 01:18AM
Thanks guys - good advice as always!

I'll start "playing" with your suggestions...
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: