Recent

Author Topic: Move tab to other pagecontrol  (Read 530 times)

majid.ebru

  • Hero Member
  • *****
  • Posts: 530
Move tab to other pagecontrol
« on: March 17, 2025, 01:37:00 pm »
Hi
how can I move a tab to other pagecontrol ?
Thank

wp

  • Hero Member
  • *****
  • Posts: 12753
Re: Move tab to other pagecontrol
« Reply #1 on: March 17, 2025, 01:58:18 pm »
simply by setting the Parent or PageControl properties of the tab to the other PageControl. Note that for whatever readon the TabVisible property must be reset to true after moving to the other container.

Tested on Windows:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   sheet: TTabSheet;
  4. begin
  5.   sheet := PageControl1.ActivePage;
  6.   if sheet <> nil then
  7.   begin
  8.     sheet.PageControl := Pagecontrol2;
  9.     sheet.TabVisible := true;
  10.   end;
  11. end;

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10996
  • Debugger - SynEdit - and more
    • wiki
Re: Move tab to other pagecontrol
« Reply #2 on: March 17, 2025, 04:40:41 pm »
Use TExtendedNotebook from the tab "LazControls" (package LazControls).

That is the same notebook used by the IDE for the source editor, and supports moving tabs between 2 notebooks.

You may still have to hook the events for on drop or on accept...

majid.ebru

  • Hero Member
  • *****
  • Posts: 530
Re: Move tab to other pagecontrol
« Reply #3 on: March 20, 2025, 01:15:57 pm »
simply by setting the Parent or PageControl properties of the tab to the other PageControl. Note that for whatever readon the TabVisible property must be reset to true after moving to the other container.

Tested on Windows:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   sheet: TTabSheet;
  4. begin
  5.   sheet := PageControl1.ActivePage;
  6.   if sheet <> nil then
  7.   begin
  8.     sheet.PageControl := Pagecontrol2;
  9.     sheet.TabVisible := true;
  10.   end;
  11. end;

Thank you

 

TinyPortal © 2005-2018