Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-09

Adding and hiding TPageControl tabs

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

I know that this should be an FAQ, but Google isn't being much help.

I've got a TPageControl with a single design-time page, on which there's a Synedit which is used (a) as a splash when there's no other tabs and (b) as a template for design-time properties.

I can add an extra tab and put a Synedit in it under program control, and load it with text. What I can't do is hide the original (index zero) tab: if I do, the Synedit vanishes:

procedure TListerD.tntShim;
var     tab: TTabSheet;
         syn: TSynEdit;
begin
   tab := fTntPageControl.AddTabsheet;
   tab.parent := fTntPageControl;     // Is this necessary?
   tab.Caption := 'New';
   syn := TSynEdit.Create(tab);
   tab.InsertControl(syn);
   syn.Parent := tab;                 // Is this necessary?
   syn.Lines.Assign(fTntStrings);
   tab.TabVisible := true;
   fTntPageControl.Pages[0].TabVisible := false; // Trouble
   fTntPageControl.ShowTabs := true;

This is a shim called from Synchronize(), fTntPageControl etc. are used as temporary storage. If the penultimate line is commented out then both tabs and their contents are visible, but if it's left in then the [0] tab is hidden and the newly-created [1] tab has no visible content.

Lazarus 1.0 on x86 Linux. Any polite suggestions appreciated.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Martin
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 9 lines
I know that this should be an FAQ, but Google isn't being much help. I've got a TPageControl with a single design-time page, on which there's a Synedit which is used (a) as a splash when there's no other tabs and (b) as a template for design-time properties. I can add an extra tab and put a Synedit in it under program control, and load it with text. What I can't do is hide the original (index zero) tab: if I do, the Synedit vanishes:

PageControl in 1.0 has many bugs.

Please try 1.0.13 not released, you can get from svn fixes branch using svn. Or 1.3 (also not released)
Or 1.1.99 from sourceforge

1.0.13 should be stable.

The other 2 are work in progress

Reply by email

Martin
to Martin
Martin wrote 21 lines
On 26/09/2013 15:32, Mark Morgan Lloyd wrote: > I know that this should be an FAQ, but Google isn't being much help. > > I've got a TPageControl with a single design-time page, on which > there's a Synedit which is used (a) as a splash when there's no other > tabs and (b) as a template for design-time properties. > > I can add an extra tab and put a Synedit in it under program control, > and load it with text. What I can't do is hide the original (index > zero) tab: if I do, the Synedit vanishes: PageControl in 1.0 has many bugs. Please try 1.0.13 not released, you can get from svn fixes branch using svn. Or 1.3 (also not released) Or 1.1.99 from sourceforge 1.0.13 should be stable. The other 2 are work in progress

Also those fixes are Gtk2, Win and QT. No idea about the other widgetsets.

And:
I do not know if all widgetsets suppord displaying a page, when the tab is hidden. (You can hide all tabs, via ShowTabs)

This may indeed hide the page :
fTntPageControl.Pages[0].TabVisible := false; // Trouble

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd: I know that this should be an FAQ, but Google isn't being much help. I've got a…
Show quoted text 17 lines
> I've got a TPageControl with a single design-time page, on which there's > a Synedit which is used (a) as a splash when there's no other tabs and > (b) as a template for design-time properties. > > I can add an extra tab and put a Synedit in it under program control, > and load it with text. What I can't do is hide the original (index zero) > tab: if I do, the Synedit vanishes: > PageControl in 1.0 has many bugs. > Please try 1.0.13 not released, you can get from svn fixes branch using svn. Or 1.3 (also not released) Or 1.1.99 from sourceforge 1.0.13 should be stable. The other 2 are work in progress

Thanks, I'll investigate upgrades.

Show quoted text 6 lines
Also those fixes are Gtk2, Win and QT. No idea about the other widgetsets. And: I do not know if all widgetsets suppord displaying a page, when the tab is hidden. (You can hide all tabs, via ShowTabs)

I'm not trying to hide the tab but still see the page, I'm trying to hide the entire page+tab+content (index zero) and only leave the newly-created one (again, page+tab+content). But the last time I did any of this was around about the time that the old TNotebook etc. was deprecated, and I'm assuming that the rather convoluted sequence I was using in those days is no longer appropriate.

This may indeed hide the page : fTntPageControl.Pages[0].TabVisible := false; // Trouble

It hides everything at [0], but also hides the content of [1].

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Martin
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 11 lines
> Please try 1.0.13 not released, you can get from svn fixes branch > using svn. > Or 1.3 (also not released) > Or 1.1.99 from sourceforge > > 1.0.13 should be stable. > > The other 2 are work in progress Thanks, I'll investigate upgrades.

btw, trunk may have more fixes...

I did merge a lot of fixes for pagecontrol, but not 100% sure, if it wal all of them.

Reply by email

stdreamer
to Mark Morgan Lloyd: Thanks, I'll investigate upgrades. I'm not trying to hide the tab but still see the page,…
Mark Morgan Lloyd wrote 39 lines
>> I've got a TPageControl with a single design-time page, on which >> there's a Synedit which is used (a) as a splash when there's no other >> tabs and (b) as a template for design-time properties. >> >> I can add an extra tab and put a Synedit in it under program control, >> and load it with text. What I can't do is hide the original (index >> zero) tab: if I do, the Synedit vanishes: >> PageControl in 1.0 has many bugs. >> > Please try 1.0.13 not released, you can get from svn fixes branch > using svn. > Or 1.3 (also not released) > Or 1.1.99 from sourceforge > > 1.0.13 should be stable. > > The other 2 are work in progress Thanks, I'll investigate upgrades. > Also those fixes are Gtk2, Win and QT. No idea about the other > widgetsets. > > And: > I do not know if all widgetsets suppord displaying a page, when the > tab is hidden. (You can hide all tabs, via ShowTabs) I'm not trying to hide the tab but still see the page, I'm trying to hide the entire page+tab+content (index zero) and only leave the newly-created one (again, page+tab+content). But the last time I did any of this was around about the time that the old TNotebook etc. was deprecated, and I'm assuming that the rather convoluted sequence I was using in those days is no longer appropriate. > This may indeed hide the page : > fTntPageControl.Pages[0].TabVisible := false; // Trouble It hides everything at [0], but also hides the content of [1].

That's because you should not hide the tabsheet, just make the [1] the active tabsheet (AKA the selected and visible one) and the user will not be able to select the [0] that has the tab hidden until you show the hidden tab.

Reply by email