Recent

Author Topic: Page Control  (Read 13399 times)

metalistas2

  • New member
  • *
  • Posts: 7
Page Control
« on: May 22, 2011, 05:45:24 pm »
How make thant I can add many pages to pagcontrol then delite and add again with no program crash %)

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Page Control
« Reply #1 on: May 22, 2011, 06:14:31 pm »
Once you have PageControl1: TPageControl on your form you can do:
Code: [Select]
with TTabSheet.Create(self) do
    begin
      Parent:=PageControl1;
      // here you can set other parameters
    end;
for creating new page and
Code: [Select]
  PageControl1.ActivePage.Free;
or
Code: [Select]
PageControl1.Pages[PageControl1.PageIndex].Free;
for deleting active page
or
Code: [Select]
PageControl1.Pages[i].Free;i can be one of your pages.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

metalistas2

  • New member
  • *
  • Posts: 7
Re: Page Control
« Reply #2 on: June 05, 2011, 09:18:38 pm »
no no ... Problem is .. then i creating " Add new tab" with pagecount ...

see

in My editor is 2 tabs named 'tab 1' and 'tab 2'

I delite 'tab 1' and adding new tab program crash ... I dont know how make normal tabing

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Page Control
« Reply #3 on: June 05, 2011, 10:13:10 pm »
This works (TabSheet1 is added in Object Inspector):
Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
begin
  TabSheet1.Free;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  TabSheet1:=TTabSheet.Create(self);
    with TabSheet1 do
      begin
        Parent:=PageControl1;
        Caption:='TabSheet1';
      end;
end;               
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

metalistas2

  • New member
  • *
  • Posts: 7
Re: Page Control
« Reply #4 on: June 05, 2011, 10:19:30 pm »
Damn Yeah :D Thanks ...!!!!!!  ;D

but soething is wrong with :

var's  tabs: TTabSheet;

Quote
procedure TForm1.MenuItem40Click(Sender: TObject);
begin
  tabs.ActivePage.Free;
end;


I get :

Source\main.pas(95,8) Error: identifier idents no member "ActivePage"
« Last Edit: June 05, 2011, 10:32:52 pm by metalistas2 »

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Page Control
« Reply #5 on: June 05, 2011, 10:38:25 pm »
Yes, error message is right. ActivePage is member of TPageControl

You should write:
Code: [Select]
PageControl1.ActivePage.Free;
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

metalistas2

  • New member
  • *
  • Posts: 7
Re: Page Control
« Reply #6 on: June 05, 2011, 10:40:05 pm »
Thanks Again ;]

And how make activepage ?
« Last Edit: June 05, 2011, 11:40:50 pm by metalistas2 »

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Page Control
« Reply #7 on: June 05, 2011, 11:57:47 pm »
Code: [Select]
PageControl1.ActivePage:=TabSheet1;
OR
Code: [Select]
PageControl1.ActivePage:=PageControl1.Pages[0];
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

metalistas2

  • New member
  • *
  • Posts: 7
Re: Page Control
« Reply #8 on: June 06, 2011, 12:13:04 am »
not working ://

here is my source
Quote
    tabs:=TTabSheet.Create(self);
    with tabs do
      begin
        Parent:=PageControl1;
        Caption:='~Empty~';

      end;
      PageControl1.ActivePage:=TabSheet1;
      editor := TSynEdit.Create(nil);
      editor.parent := TabSheet1;
      editor.Align:=alClient;
   


Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Page Control
« Reply #9 on: June 06, 2011, 12:41:28 am »
OK, then
Code: [Select]
PageControl1.ActivePage:=tabs;It really depends what TabSheets you created in Object Inspector and what TabSheets you created in code.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

 

TinyPortal © 2005-2018