As far as I can see the only way to handle insertion is by adding a new tab sheet at the end and then re-writing the captions and contents from the intended insertion point to the end and handle caption changes by rewriting captions and contents between the old and new positions of the caption.No, not so complicated. Yes - you must "AddTabSheet" to add a new tab sheet to the end, but to move it to another location you simply set its PageIndex as required.
I am talking of PageIndex. And before you complain: yes, the internal structure of this group of components with tabs, pages, NBPages etc. is very complex indeed (and maybe not done in the best way...)Would it be too hard to insert an optional [x] like Mozilla Firefox on TTabSheet original source code to easily close that page (tabsheet)?
type TCustomPage = class(TWinControl) public property PageIndex: Integer read FPageIndex write SetPageIndex; end; TTabSheet = class(TCustomPage)
Would it be too hard to insert an optional [x] like Mozilla Firefox on TTabSheet original source code to easily close that page (tabsheet)?
I am talking of PageIndex.
I have tried both nboShowAddTabButton and nboShowCloseButtons, but nothing happens on Microsoft Windows 7 and 10 neither on design nor on run time.Would it be too hard to insert an optional [x] like Mozilla Firefox on TTabSheet original source code to easily close that page (tabsheet)?Won't setting nboShowCloseButtons in the page control's Options do that?
Note that the tabs themselves and the contents of the pages (TTabSheet) are two separate things.
I have tried both nboShowAddTabButton and nboShowCloseButtons, but nothing happens on Microsoft Windows 7 and 10 neither on design nor on run time.
You are right, it feels like a widgetset-dependent problem.I have tried both nboShowAddTabButton and nboShowCloseButtons, but nothing happens on Microsoft Windows 7 and 10 neither on design nor on run time.It does on Linux-GTK2 (see atached image) so it must be widgetset-dependent :(
I'll make some tests on Windows in a little while.
I am talking of PageIndex. And before you complain: yes, the internal structure of this group of components with tabs, pages, NBPages etc. is very complex indeed (and maybe not done in the best way...)
type TCustomPage = class(TWinControl) public property PageIndex: Integer read FPageIndex write SetPageIndex; end; TTabSheet = class(TCustomPage)
I tend to agree with wp that the Lazarus implementation of TPageControl would probably be better if it were started from scratch today. Probably it has the awkward design it has because of the very diverse widgetsets it has to accommodate while still being "based" on the Delphi VCL template with which it has to be compatible.I also agree with both of you, but even if TPageControl would be redone from scratch, would that be accepted by Lazarus core developers?
Attached is a simple example exercising a TPageControl descendant that provides a built-in memo per page, and tabs sorted in alphabetical order. I've provided for adding new tabs and renaming existing tabs. You could extend it for deletion of tabs without too much trouble I think.Do you think that extending TPageControl would be the best way to implement both nboShowAddTabButton and nboShowCloseButtons behaviors on Microsoft Windows?
Do you think that extending TPageControl would be the best way to implement both nboShowAddTabButton and nboShowCloseButtons behaviors on Microsoft Windows?I am not familiar with the Windows pagecontrol widget (and use Windows only when I have to, otherwise I avoid it), so I don't know if the Windows widget is capable of being "extended" to offer this functionality. If it is not so extensible, a Windows solution with closeable tabs would have to be custom-drawn, which goes against the LCL philosophy.
It's all there and allready done:
procedure TForm1.FormCreate(Sender: TObject); begin PageControl1.Options := PageControl1.Options + [nboShowCloseButtons]; end;
[... etc ...]
it doesn't work on Windows. Thas's the problem.
Yes, a couple of years ago I was unpleasantly surprised (being a linux-gtk user while most of my user audience were on windows) by this fact.
IIRC, QT doesn't support close button too.
After all I ended with my own tabbed-page-control based on EyeCandy Controls' tabs.
Is Eye Candy Controls still actively maintained?it doesn't work on Windows. Thas's the problem.Yes, a couple of years ago I was unpleasantly surprised (being a linux-gtk user while most of my user audience were on windows) by this fact.
IIRC, QT doesn't support close button too.
After all I ended with my own tabbed-page-control based on EyeCandy Controls' tabs.
Actually, Qt and Qt5 supports close buttons on tabs on all supported platforms by Qt/Qt5.
Is Eye Candy Controls still actively maintained?Don't know. To me, it's relatively stable (currently I use tabs only).