Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 8 Jahren, 4 Monaten
Letzter Beitrag:
vor 8 Jahren, 4 Monaten
Beteiligte Autoren:
DarrenF, Piet van Zanten, Milton, Fabrice Harari.pcs.crosspost, Al

Dynamic Tab control

Startbeitrag von DarrenF am 07.05.2009 00:17

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...

Antworten:

Can assume it's not possible? :confused:

von DarrenF - am 07.05.2009 13:12
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

von Al - am 07.05.2009 14:10

Re: Dynamic Tab control

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 http://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

von Fabrice Harari.pcs.crosspost - am 07.05.2009 14:38
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

von Milton - am 07.05.2009 20:21
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.



von Piet van Zanten - am 07.05.2009 21:48
Thanks guys - good advice as always!

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


von DarrenF - am 07.05.2009 23:18
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.