[Solved] - Buttons in TTabsheet and TPageControl lazarus / 31-LCL ---------------------------------------------------------------------- zxandris · 2023-10-16 06:00 Okay I've noticed that the PageControl options say you can have close buttons on the tabs, but I've set this and they're not showing up.  I'm assuming there is more work to be done, and would like to please ask what actually needs to happen to get those close buttons to show up on the tab, and presumably setup an event to catch the click? Any help would be appreciated, I can't so much offer a code example here, as to me it seems like it's a simple property set, but I'm going out on a limb and saying it's not that easy since that's not working for me. ---------------------------------------------------------------------- cdbc · 2023-10-16 06:13 Hi 1) In the ObjectInspector, choose "PageControl1" -> find the "Options" section    -> find "ShowCloseButton" and turn it on. 2) In the ObjectInspector, choose the page "Events" -> find "CloseTab"    -> click the elipsis(...) and create an event-handler for that:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.PageControl1CloseTabClicked(Sender: TObject); { * }begin  (Sender as TTabSheet).Free;end; HTH Regards Benny ---------------------------------------------------------------------- zxandris · 2023-10-16 06:15 Doh! so all I needed to do was add the event and then the button will actually show? ---------------------------------------------------------------------- Handoko · 2023-10-16 06:30 Close button for tabs is working good on Linux. But the buttons won't appear on Windows. It could be widgetset issue, bug or unimplemented feature, I am not sure. If anyone interested, you can submit a bug report. Luckily there is a workaround for it. I have tested it on Windows, it worked: https://forum.lazarus.freepascal.org/index.php/topic,52236.msg384585.h tml#msg384585 ---------------------------------------------------------------------- cdbc · 2023-10-16 06:31 Hi Well, this way works for me in a heartbeat  Btw. if you want a button on your tabsheet to close the tabsheet, you have to use "SendMessage" to do so  Regards Benny ---------------------------------------------------------------------- zxandris · 2023-10-16 06:33 Quote from: Handoko on October 16, 2023, 08:30:13 amClose button for tabs is working good on Linux. But the buttons won't appear on Windows. It could be widgetset issue, bug or unimplemented feature, I am not sure. If anyone interested, you can submit a bug report. Luckily there is a workaround for it. I have tested it on Windows, it worked: https://forum.lazarus.freepascal.org/index.php/topic,52236.msg384585.h tml#msg384585 Thanks, I'll give that a go ---------------------------------------------------------------------- Awkward · 2023-10-16 08:35 Quote from: Handoko on October 16, 2023, 08:30:13 amClose button for tabs is working good on Linux. But the buttons won't appear on Windows. It could be widgetset issue, bug or unimplemented feature, I am not sure. That is not bug. This is F*king windows issue. MS Windows don't have native "close" buttons there. Another question, why it was not implemented by LCL internally... ---------------------------------------------------------------------- zxandris · 2023-10-16 08:36 From a glance at the code I assume I'll have to create this dynamically as it's not set up as a component.  I'm not alien to doing that but I've not done it much yet.  Honestly, I've been programming years but in many ways I would still consider myself a noob.  So tips would be helpful ---------------------------------------------------------------------- TRon · 2023-10-16 08:45 Quote from: zxandris on October 16, 2023, 10:36:59 amFrom a glance at the code I assume I'll have to create this dynamically as it's not set up as a component. ... So tips would be helpful I couldn't locate a wiki page on the first page of my search results (bad day for getting the right search-terms it seems  ) but found this so q&a and this thread instead. Delphi and Lazarus are practically similar in that regards so the links should be able to get you going ? ---------------------------------------------------------------------- zxandris · 2023-10-16 09:20 That helps thanks, luckily it's not alien to me, i was just curious as to the exact details of https://forum.lazarus.freepascal.org/index.php /topic,52236.msg384585.html#msg384585 really. ---------------------------------------------------------------------- TRon · 2023-10-16 09:54 @zxandris: As far as I am able to tell form my quick glance over the code in that link there are no new properties or other storage streams introduced which afaik means that you can literally copy the code and drop a tpagecontrol on your form with the designer (note the order in the original source-code which allows to override the original tpagecontrol component with the customized implementation. ---------------------------------------------------------------------- zxandris · 2023-10-16 10:51 That's great I'll experiment a little before I try to insert that into my more production code I think.  I'm essentially trying to implement as close as I can get to a browser like tab control, so I suppose the next question is how do I change the color of the tabs? .  It sounds simple, but I seriously doubt it is so.  I'm still very inexperienced with that sort of thing and I suspect that some sort of custom control might be required which is definitely beyond anything I've done before.  But I'm keen to get this working for my project.  Any help would be appreciated. ---------------------------------------------------------------------- TRon · 2023-10-16 12:14 Quote from: zxandris on October 16, 2023, 12:51:49 pm...trying to implement as close as I can get to a browser like tab control, so I suppose the next question is how do I change the color of the tabs? .  It sounds simple, but I seriously doubt it is so.  I'm still very inexperienced with that sort of thing and I suspect that some sort of custom control might be required which is definitely beyond anything I've done before.  But I'm keen to get this working for my project.  Any help would be appreciated. Perhaps not exactly what you are looking for but I was very impressed by all shenanigans from ATTabs. There are more customdrawn controls out there (customdrawn is probably most helpful for your use case because it unties things with the OS widgetset). ---------------------------------------------------------------------- d7_2_laz · 2023-10-16 12:52 Once being in the same situation, i'd decided for this ATTabs and i'm happy with it due to it's configuration and styling capabilities. https://forum.lazarus.freepascal.org/index.php/topic,53422.msg395158.h tml#msg395158 ---------------------------------------------------------------------- jamie · 2023-10-17 00:24 I subclassed the TpageControl locally and I put combo boxes on the selected tab and normal looking unselected. The Drop down selects the caption for that tab which also indicates mode of operation for that tab. ---------------------------------------------------------------------- zxandris · 2023-10-18 12:39 I've gotten buttons on the tabs thanks to the link in another posting, but I will for sure try out ATTabs, they appear to be exactly what I'm looking for. Thanks guys, CJ