Recent

Author Topic: ATTabs how i can add frame form in tab  (Read 512 times)

eldonfsr

  • Sr. Member
  • ****
  • Posts: 443
ATTabs how i can add frame form in tab
« on: June 09, 2022, 03:48:08 pm »
Hi i started to work on this component looks great but a few documents you can find to follow or do something on it, here i trying to frame inside tab but always i have errror...

It look frame is in side the tab but is not if you click on + to add  new tab i received a error...


eldonfsr

  • Sr. Member
  • ****
  • Posts: 443
Re: ATTabs how i can add frame form in tab
« Reply #1 on: June 09, 2022, 03:55:35 pm »
when click + sign to add new tab

Code: Pascal  [Select][+][-]
  1. procedure TFormCliDat.ATTabs1TabPlusClick(Sender: TObject);
  2. var
  3.   d: TATTabData;
  4. begin
  5.   ATTabs1.AddTab(-1,'New', nil, false);
  6.   d:= ATTabs1.GetTabData(ATTabs1.TabIndex);
  7.  if Assigned(d) then begin
  8.       (d.TabObject as TFrameClie).Show;
  9.       FrameClie1.Memo1.Lines.Clear;
  10.       FrameClie1.Memo1.Lines.Add('Test Texto');
  11.  end else begin
  12.      (d.TabObject as TFrameClie).Show;
  13.  end;
  14.  
  15. end;    
  16.  
Code: Pascal  [Select][+][-]
  1. procedure TFormCliDat.FormShow(Sender: TObject);
  2. Var d: TATTabData;
  3. begin
  4.   if( Lnew=true) then begin
  5.     FrameClie1.Edit1.Text:='';
  6.     FrameClie1.Edit2.Text:='';
  7.   end else begin
  8.     FrameClie1.Edit1.Text:= FormCtrCli.SQLQClie.FieldByName('numcli').AsString;
  9.     FrameClie1.Edit2.Text:=FormCtrCli.SQLQClie.FieldByName('nomcli').AsString;
  10.   end;
  11. end;  
  12.  

AlexTP

  • Hero Member
  • *****
  • Posts: 2365
    • UVviewsoft
Re: ATTabs how i can add frame form in tab
« Reply #2 on: June 29, 2022, 12:56:06 pm »
I see that you pass Nil value of TabObject (member of TATTabData) and then you access this Nil value as TFrameClie object.

Code: Pascal  [Select][+][-]
  1.   ATTabs1.AddTab(-1,'New', nil, false);
  2.   d:= ATTabs1.GetTabData(ATTabs1.TabIndex);
  3.  if Assigned(d) then begin
  4.       (d.TabObject as TFrameClie).Show;

solution: pass OK pointer in AddTab().

IIRC someone already asked this in GitHub in last months.
« Last Edit: June 29, 2022, 12:57:55 pm by AlexTP »

 

TinyPortal © 2005-2018