Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Label in a TPanel
Sun, Oct 15 2017 7:49 PMPermanent Link

KimHJ

Comca Systems, Inc

I'm trying to create a label inside  a TPanel. I get an error at: MyPanel := FindComponent('PT' + Ticketnum) as TPanel;

var
MyPanel: TPanel;
begin      
  PickScrollPanel.BeginUpdate;
  try     
        with TPanel.Create(PickScrollPanel) do
           begin
            Layout.Position:=lpTopLeft;
           Layout.Consumption:=lcRight;
           Layout.Overflow:=loBottom;
           Background.Fill.Color:=clLightGreen;
           CaptionBar.Background.Fill.Color:=clDarkGreen;
           CaptionBar.Caption:='Ticket '+Ticketnum;
           CaptionBar.AllowMinimize:=True;  
           Captionbar.AllowClose := False;
           CaptionBar.AllowMove:=False;
           CaptionBar.Height := 22;
           CaptionBar.Font.Style.Bold := True;
           Width:=180;
           Height:=150;
           Margins.Left:=5;
           Margins.Top:=5;
           Name := 'PT' + Ticketnum;
           end;
           MyPanel := FindComponent('PT' + Ticketnum) as TPanel;
       with TLabel.Create(MyPanel) do
           begin
                 Layout.Position:=lpTopLeft;
                 Layout.Consumption:=lcRight;
                 Layout.Overflow:=loBottom;
                 Margins.Top := 3;
                 Margins.Left := 3;
                 Margins.Right := 3;
                 Margins.Bottom := 3;
                 Name := 'PTLB' + Ticketnum;
                 Caption := 'This a test\r\n and this is a new line';
                 Font.Color := clElevateBlue;
                 Parent := MyPanel;
           end;
  finally
     PickScrollPanel.EndUpdate;
  end;


Thanks for any help.
Kim
Sun, Oct 15 2017 7:51 PMPermanent Link

KimHJ

Comca Systems, Inc

Sorry wrong Forum
Image