Recent

Author Topic: Pagecontrol - Tabsheet captures position line  (Read 557 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1069
Pagecontrol - Tabsheet captures position line
« on: March 18, 2025, 10:43:39 am »
There is a PageControl with many, many tabsheets. Lazarus does the good choice to place some of them them into a second line of my pagecontrol. In the first line there are 15 tabbsheets selectable, in the second line / row there are 8 tabsheets.  Fine.

What annoys me: The both lines change: The upper line with tabshees-captures becomes the lower line and vice versa. How to fixate them? How to enforce, the the upper line STAYS in the upper position and does not change place with the lower line after selections?


jamie

  • Hero Member
  • *****
  • Posts: 6874
Re: Pagecontrol - Tabsheet captures position line
« Reply #1 on: March 18, 2025, 04:08:29 pm »
Maybe u need two controls, ttabcontrol and a tnotebook.
The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11030
  • Debugger - SynEdit - and more
    • wiki
Re: Pagecontrol - Tabsheet captures position line
« Reply #2 on: March 18, 2025, 05:10:10 pm »
Tab/Page control are components by the OS (Windows, gtk, qt, cocoa). Those OS control the behaviour.

I don't know if any (and/or which) of those OS offer settings that could change this. But afaik, even if, its not implemented in the LCL.

As for Windows, as far as I am aware there is no option in the Windows API to control this.


There may be some custom drawn page controls if you search for them. They might look different, especially if you use them cross platform, but the might offer this as they aren't OS dependent.

wp

  • Hero Member
  • *****
  • Posts: 12761
Re: Pagecontrol - Tabsheet captures position line
« Reply #3 on: March 18, 2025, 05:21:02 pm »
Does the PageControl have to look exactly like a "PageControl"? If you have more relaxed requirements you could use a TNoteBook rather than a TPageControl. It also provides several pages, but there are no tabs - you must find another way to select the pages than clicking on tabs. You could use a TCombobox? Or, probably more pagecontrol-like, a TToolbar? You can even wrap the buttons (without mixing the order of rows)

See attached example.
« Last Edit: March 18, 2025, 05:24:07 pm by wp »

Nicole

  • Hero Member
  • *****
  • Posts: 1069
Re: Pagecontrol - Tabsheet captures position line
« Reply #4 on: March 18, 2025, 07:58:00 pm »
Thank you for all fot the replies.

Unfortunately it MUST look as a page control and I am discouraged of trying alternative components. I thought it more easily.  :'(

I asked ChatGPT and it guessed, I can do it in the onChange event and re-order the tab-numbers. This would cause them to be re-arranged. Not sure, how this should work exactly. Does this seem promising to you?

ChatGPT wrote for me complete code snippets sometimes. And sometimes it gives sucker-suggestions, using properties, which do not exist and loops, no beginner would accept. So I did not try it before somebody says, this sounds good. Will this reduce the performance? Does the onchange event fire every click or only if I use a different TabShee?

What do you think about it?

If it is too hard, I will live with it. It is not worth to work some days for this optics.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11030
  • Debugger - SynEdit - and more
    • wiki
Re: Pagecontrol - Tabsheet captures position line
« Reply #5 on: March 18, 2025, 08:22:41 pm »
Reordering wont help. Because never mind at which index-position the active tab is, at least windows will sort the row with the active tab down.

Technically you could create several tab-riders (just the tabs of a page control), and sort the tabs into the riders yourself. Making sure each stays single line. But then you must do all the measuring yourself. (and put the components into a notebook without tabs, so you can switch them when tabs change).
Of course, technically, if the active tab isn't on the bottom, then it wont look like a page control, because a page control looks like that the tab is switching row...


 

TinyPortal © 2005-2018