Recent

Author Topic: TPageControl - "owner draw"  (Read 800 times)

Nicole

  • Hero Member
  • *****
  • Posts: 970
TPageControl - "owner draw"
« on: August 05, 2022, 05:32:59 pm »
Coming from Delphi, Lazarus complains, "I do not know owner draw".

I used this ownerdraw to color PageControl-tabs in series to group them.
Is there a way to color a TPageControl tab? To Group them?

I found, that I can decorate them by small images, which is nice. Never the less a "group-them-color" would be quite helpful, the moment there are many tabs.

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: TPageControl - "owner draw"
« Reply #1 on: August 05, 2022, 05:49:40 pm »
Is there a way to color a TPageControl tab?

As far as I know no. Alternatively, you can try:
https://wiki.freepascal.org/ATTabs

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: TPageControl - "owner draw"
« Reply #2 on: August 05, 2022, 06:49:45 pm »
Thank you for your answer and this link.
I read it and read it again and I am aware, there should be explained, what I need to know.
But I do not get it.

These frames, this is exactly what I need.
At the moment, I work with parent and it is no fine working.
Unfortunately, I need these frames interacting with each other. So I need to address them.

Will this be easier or harder by ATTabs?

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: TPageControl - "owner draw"
« Reply #3 on: August 05, 2022, 07:57:02 pm »
First of all, I don't see any benefit of using a TFrame and set a tabsheet as the frame's parent. Instead I use TForm and this is my code:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   NewTab: TTabSheet;
  4.   SubForm: TSubForm;
  5. begin
  6.   SubForm             := TSubForm.Create(Self);
  7.   NewTab              := PageControl1.AddTabSheet;
  8.   NewTab.Caption      := SubForm.Caption;
  9.   SubForm.Parent      := NewTab;
  10.   SubForm.Align       := alClient;
  11.   SubForm.BorderStyle := bsNone;
  12.   SubForm.Show;
  13. end;

TSubForm is a normal form but I have customized its appearance and added some buttons. So all the tabs will have some similar appearance and buttons.

At the moment, I work with parent and it is no fine working.

Please provide a compilable demo so I can download, test and understand the problem.

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: TPageControl - "owner draw"
« Reply #4 on: August 05, 2022, 08:16:13 pm »
Thank you so much for the offer!
But - this would be a work of a week for you.

I have a huge project in Delphi XE3, which works with Frames. Many frames.
About 10 years I put every new idea or feature into a new frame, - they summed up.
So I need a way to re-use these frames (and drop some of them).

Why I "cannot" send it: I used elements heavily which are not in Lazarus: FireDAC, TMS, TChart Pro.
So every single line is a problem. I can only import frame by frame to my new Lazarus thing.

So the Frames exist already.
But as I have so many troubles with them:
Is it better to work with Subforms?
If the advantages are there, I do this change.

The reason, why I worked with frames is organization. Every frame is rather of a huge functionality.

What I need is something like this:
Frame13 must be able to adresse every variable of Frame4 etc. They interact.

 

TinyPortal © 2005-2018