Recent

Author Topic: [solved] TFrame + TTabSheet  (Read 960 times)

andyH

  • Jr. Member
  • **
  • Posts: 99
[solved] TFrame + TTabSheet
« on: February 10, 2022, 07:46:14 pm »
I have posted on a similar topic and not had any useful response. I have a sample project to demonstrate:

Main form + TPageControl with tabsheets. A TFrame as a container for a number of objects that sit on the tabsheet. Compiles and runs okay with GTK - screenshot (deliberately set the frame colour red).

Compile with QT and not okay - screenshot. It appears as if the TFrame is not rendered on the tabsheet. FButton is a button on the tabsheet - to confirm that QT will display objects on a tabsheet. With GTK FButton is hidden behind the TFrame.

I had previously tried this with a TPanel and got the same behaviour, switched from a TPanel as a container to a TFrame - no change.

I've attached the sample project.

I'm running Linux Mint 20.3 with Lazarus 2.0.10 and have installed libqt5pas version 2.9 (https://github.com/davidbannon/libqt5pas/releases/tag/v1.2.9).

Is it me or a bug?
« Last Edit: February 11, 2022, 01:01:25 pm by andyH »

zoltanleo

  • Sr. Member
  • ****
  • Posts: 439
Re: TFrame + TTabSheet
« Reply #1 on: February 11, 2022, 08:32:24 am »
Hey andyH

I have no problem on win32 with frame as container
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by Rik

Sorry for my bad English, I'm using translator ;)

zeljko

  • Hero Member
  • *****
  • Posts: 1281
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TFrame + TTabSheet
« Reply #2 on: February 11, 2022, 08:36:26 am »
It works here BUT change Anchors and Width/Height with align:
  TestFrame:= TFrame2.Create(self);
  //with TestTab do
  with TestFrame do
      begin
        Align := alClient;
        // Anchors:=[akLeft,akTop,akRight,akBottom]; //dont think does anything.
        Parent:= PageCtrl.Page[0];
        //Width:= Parent.ClientWidth;
        //Height:= Parent.ClientHeight;
      end;

andyH

  • Jr. Member
  • **
  • Posts: 99
Re: TFrame + TTabSheet
« Reply #3 on: February 11, 2022, 01:00:47 pm »
@zeljko - thanks 

Made the changes, from:
Code: Pascal  [Select][+][-]
  1.   with TestFrame do
  2.       begin
  3.         Anchors:=[akLeft,akTop,akRight,akBottom]; //dont think does anything.
  4.         Parent:= PageCtrl.Page[0];
  5.         Width:= Parent.ClientWidth;
  6.         Height:= Parent.ClientHeight;
  7.       end;
to
Code: Pascal  [Select][+][-]
  1.    with TestFrame do
  2.       begin
  3.         Align := alClient;
  4.         Parent:= PageCtrl.Page[0];
  5.       end;
and it worked. Although why it was okay with GTK2 and not QT5, don't know.

So simple, but I suspect I would not have found that on my own.

Thanks again.


 

TinyPortal © 2005-2018