Lazarus

Programming => General => Topic started by: jptferreira on May 23, 2019, 10:52:48 pm

Title: TPageControl cross-platform question
Post by: jptferreira on May 23, 2019, 10:52:48 pm
When porting the code from linux to a windows installation all works great but the TPageControl doesn't show correctly under windows.
Because I selected to the the tabs on the left side, on linux it shows great with the tabs horizontal. On Windows it shows vertically and with the too and that makes it harder to read. At the same time it ruins the layout because it adjust the pagecontrol content.
Any hint on why this happens? Is there any workaround to have the windows layout to be kept the same as linux?
Thanks! ;)
Title: Re: TPageControl cross-platform question
Post by: jamie on May 23, 2019, 11:00:18 pm
are you referring to the "TEXT" in the tabs not being horizontal ?
Title: Re: TPageControl cross-platform question
Post by: jptferreira on May 23, 2019, 11:20:54 pm
Not just the text, even the tabs become vertical while on linux they are horizontal even if on the left, top or bottom.
Even just creating a new TPageControl and moving the tabs to the left will do that, instead of keeping the same orientation, it just changes to horizontal... I'm puzzled! Can be that I'm too tired and cannot see the most obvious! Thanks for your reply

 :D
Title: Re: TPageControl cross-platform question
Post by: RAW on May 23, 2019, 11:23:03 pm
A picture says more than 1000 words ...  :)
Title: Re: TPageControl cross-platform question
Post by: jamie on May 24, 2019, 12:08:19 am
That problem has been around for a while now..

I fyou set the width of the tabs while they are vertical they kind of do the opposite of what you think.

it's how you think about it..

 Think of the TABS as being rotated as you'll also notice the text is vertical, up for the left and down for the right.

 The Tab widths and height rotate with it in their origination.

 I believe this is how windows implements it..

Title: Re: TPageControl cross-platform question
Post by: wp on May 24, 2019, 12:43:26 am
Any hint on why this happens? Is there any workaround to have the windows layout to be kept the same as linux?
The pagecontrol is a control which depends strongly on the widget set. I checked several component packages but did not find a pagecontrol-like component in which the tabs can be moved to the left and the text remains horizontal. Maybe you can combine some kind of vertical menu component (such as JVCL's TOutlookbar, or maybe even a TListbox could be sufficient) with a TNotebook.
Title: Re: TPageControl cross-platform question
Post by: jamie on May 24, 2019, 01:59:26 am
The TTabControl if set to LEFT, and with MULTILINE on, will cascade the Tabs down the side with text horizontal.

You can place this beside a TNoteBook and construct what you need.

TPageControl also has this however, the Multiline does not seem to have any effects when doing so?
Title: Re: TPageControl cross-platform question
Post by: lucamar on May 24, 2019, 03:40:21 am
A picture says more than 1000 words ...  :)

Enjoy these 2000 words :)
Title: Re: TPageControl cross-platform question
Post by: RAW on May 24, 2019, 05:14:37 am
Quote
Enjoy these 2000 words :)
:D

Interesting, I've never seen this kind of bug.
// That's not a standard XP Theme ... is it ???
Title: Re: TPageControl cross-platform question
Post by: lucamar on May 24, 2019, 07:46:44 am
// That's not a standard XP Theme ... is it ???

No, it is Crystal dlb 2.
Title: Re: TPageControl cross-platform question
Post by: valdir.marcos on May 24, 2019, 09:10:04 am
When porting the code from linux to a windows installation all works great but the TPageControl doesn't show correctly under windows.
Because I selected to the the tabs on the left side, on linux it shows great with the tabs horizontal. On Windows it shows vertically and with the too and that makes it harder to read. At the same time it ruins the layout because it adjust the pagecontrol content.
Any hint on why this happens? Is there any workaround to have the windows layout to be kept the same as linux?
Thanks! ;)

Not just the text, even the tabs become vertical while on linux they are horizontal even if on the left, top or bottom.
Even just creating a new TPageControl and moving the tabs to the left will do that, instead of keeping the same orientation, it just changes to horizontal... I'm puzzled! Can be that I'm too tired and cannot see the most obvious! Thanks for your reply  :D

A picture says more than 1000 words ...  :)
Attached is the default behavior for Windows 7 and 10.
Title: Re: TPageControl cross-platform question
Post by: valdir.marcos on May 24, 2019, 09:11:16 am
Any hint on why this happens? Is there any workaround to have the windows layout to be kept the same as linux?
The pagecontrol is a control which depends strongly on the widget set. I checked several component packages but did not find a pagecontrol-like component in which the tabs can be moved to the left and the text remains horizontal. Maybe you can combine some kind of vertical menu component (such as JVCL's TOutlookbar, or maybe even a TListbox could be sufficient) with a TNotebook.

Quote
Enjoy these 2000 words :)
:D
Interesting, I've never seen this kind of bug.
// That's not a standard XP Theme ... is it ???
Neither do I.
As wp said,  I don't see it as bug, but as a simple different behavior between Windows and Linux's widget sets.
Maybe jptferreira should use other component to behave differently on Windows.
Title: Re: TPageControl cross-platform question
Post by: valdir.marcos on May 24, 2019, 09:49:11 am
The TTabControl if set to LEFT, and with MULTILINE on, will cascade the Tabs down the side with text horizontal.
You can place this beside a TNoteBook and construct what you need.
It's not beautiful, but both TPageControl + TNotebook and TTabControl + TNotebook simulates the expected Linux behavior on Windows.
See attached first small sample.
Title: Re: TPageControl cross-platform question
Post by: valdir.marcos on May 24, 2019, 09:49:57 am
The TTabControl if set to LEFT, and with MULTILINE on, will cascade the Tabs down the side with text horizontal.
You can place this beside a TNoteBook and construct what you need.
It's not beautiful, but both TPageControl + TNotebook and TTabControl + TNotebook simulates the expected Linux behavior on Windows.
See attached second small sample.
Title: Re: TPageControl cross-platform question
Post by: valdir.marcos on May 24, 2019, 09:50:48 am
TPageControl also has this however, the Multiline does not seem to have any effects when doing so?
See default behavior on Windows for TPageControl.MultiLine on attached image.
Title: Re: TPageControl cross-platform question
Post by: sash on May 24, 2019, 11:23:31 am
This is not bug, but rather a specifics of underlying widget's implementation.

On gtk (and IIRC on qt too) there's a tab's close button feature, while windows lacks one, and this particular reason forced me to use custom-drawn control for my needs.

Such differences should be always taken into account, when dealing with cross-widgetset GUI apps.
Title: Re: TPageControl cross-platform question
Post by: valdir.marcos on May 24, 2019, 12:16:02 pm
This is not bug, but rather a specifics of underlying widget's implementation.
I agree.

Quote
On gtk (and IIRC on qt too) there's a tab's close button feature, while windows lacks one, and this particular reason forced me to use custom-drawn control for my needs.
If TPageControl on Windows had an "tab's close button", which is a recurrent issue, it would be an excellent feature instead of we always doing some sort of workaround to achieve it.

pagecontrol; tabsheet and close button
https://forum.lazarus.freepascal.org/index.php/topic,22678.0.html

[SOLVED] Pagecontrol and tabs
https://forum.lazarus.freepascal.org/index.php/topic,35434.0.html

TabSheet close / right click menu
https://forum.lazarus.freepascal.org/index.php/topic,27264.0.html

Disable individual tabsheets of pagecontrol
https://forum.lazarus.freepascal.org/index.php/topic,33386.0.html

How to implement a close button for a TTabsheet of a TPageControl
https://stackoverflow.com/questions/2201850/how-to-implement-a-close-button-for-a-ttabsheet-of-a-tpagecontrol

etc
https://www.google.com/search?client=firefox-b-d&q=lazarus+pagecontrol+close+tabsheet

Tab based Form error segmentation
https://forum.lazarus.freepascal.org/index.php/topic,36985.0.html

Tpagecontrol : Ttabsheet close button
https://forum.lazarus.freepascal.org/index.php/topic,8497.0.html

Custom Drawn Controls advances
https://forum.lazarus.freepascal.org/index.php/topic,15209.msg86690.html#msg86690

Dynamic GUI component - Help to understand
https://forum.lazarus.freepascal.org/index.php/topic,11731.msg59204.html#msg59204

TPageControl and close button
https://forum.lazarus.freepascal.org/index.php/topic,7952.0.html

Quote
Such differences should be always taken into account, when dealing with cross-widgetset GUI apps.
LCL should minimize those differences by implementing only the minimum features provided by all supported OSes or by extending some special features all OSes should have.
Title: Re: TPageControl cross-platform question
Post by: wp on May 24, 2019, 07:54:38 pm
LCL should minimize those differences by implementing only the minimum features provided by all supported OSes or by extending some special features all OSes should have.
I don't think so. Not every program is written to be cross-platform!

The problem is that there is a "Restrictions" page in the Object inspector which lists the incompatibilities between widget sets and which should be respected when writing cross-platform applications. But the Restrictions page, as well as "View" > "Restriction browser", is so confusing that nobody knows and understands it (including myself).
Title: Re: TPageControl cross-platform question
Post by: zoltanleo on May 26, 2019, 11:08:57 pm
LCL should minimize those differences by implementing only the minimum features provided by all supported OSes
LCL TPageControl in Lazarus has surprisingly poor functionality (especially for Windows). This is all the more surprising because TPageControl is the base component in Delphi. This is very regrettable. It also limits its use and forces you to look for other components to replace it.

@jptferreira

Try component ATTabs (you can install it from OPM) by Alextp (https://forum.lazarus.freepascal.org/index.php?action=profile;u=39659)
http://wiki.freepascal.org/ATTabs
Title: Re: TPageControl cross-platform question
Post by: jptferreira on February 02, 2021, 06:01:48 pm
I want to thank all for the replies. I'm almost done with the project and will then use ATTabs (just because of Windows :( ).
Best regards

JP
TinyPortal © 2005-2018