Recent

Author Topic: Error: Identifier not found "TPageControl"[solved]  (Read 665 times)

OH1KH

  • Jr. Member
  • **
  • Posts: 67
Error: Identifier not found "TPageControl"[solved]
« on: November 11, 2024, 03:16:05 pm »
Hi!
Running Fedora 40 with Lazarus 3.6 (rev Unknown) FPC 3.2.2 x86_64-linux-gtk2
(from Fedora packet manager)

I have routine to change form's  font (name/size). Recently  I added new block for TPageControl fomt change by just copying a previous block and change "TPageControl" to "TBitBtn"

What is wrong with this that I can not see ?

Code: Pascal  [Select][+][-]
  1. procedure TdmUtils.LoadFontSettings(aForm: TForm);
  2.  
  3.   ......
  4.   ......
  5.  
  6.     if (aForm.Components[i] is TRadioButton) then
  7.     begin
  8.       (aForm.Components[i] as TRadioButton).Font.Name := fButtons;
  9.       (aForm.Components[i] as TRadioButton).Font.Size := fbSize
  10.     end;
  11.  
  12.     if (aForm.Components[i] is TBitBtn) then
  13.     begin
  14.       (aForm.Components[i] as TBitBtn).Font.Name := fButtons;
  15.       (aForm.Components[i] as TBitBtn).Font.Size := fbSize
  16.     end;
  17.  
  18.     if (aForm.Components[i] is TPageControl) then
  19.     begin
  20.       (aForm.Components[i] as TPageControl).Font.Name := fButtons;
  21.       (aForm.Components[i] as TPageControl).Font.Size := fbSize
  22.     end;  
  23.  

When compiled I get:

dUtils.pas(2001,32) Error: Identifier not found "TPageControl"
dUtils.pas(2003,31) Error: Identifier not found "TPageControl"
dUtils.pas(2004,31) Error: Identifier not found "TPageControl"

How ever I can select (from Object inspector) a component:
pgPreferences:TPageControl
and it has a property "Font" and subProperty "Size"

or write:
aForm.Components.TPageControl.Font.Size
every time I write dot it offers the next one in list, so it must know what is TPageControl

So from where comes:  Identifier not found "TPageControl" ????

---------
P.S. the idea was to change text in Tab sheet (header). If I replace  "TPageControl" with "TTabSheet" the result is same error:Error: Identifier not found  "TTabSheet"
« Last Edit: November 11, 2024, 05:05:14 pm by OH1KH »
--
Saku

Bart

  • Hero Member
  • *****
  • Posts: 5469
    • Bart en Mariska's Webstek
Re: Error: Identifier not found "TPageControl"
« Reply #1 on: November 11, 2024, 03:35:54 pm »
IIRC then TPageControl is defined in unit ComCtrls?
So you need to add that to your uses clause.

Bart

MarkMLl

  • Hero Member
  • *****
  • Posts: 8039
Re: Error: Identifier not found "TPageControl"
« Reply #2 on: November 11, 2024, 03:52:00 pm »
IIRC then TPageControl is defined in unit ComCtrls?
So you need to add that to your uses clause.

Give a man a fish...

If you go to the documentation at https://lazarus-ccr.sourceforge.io/docs/ then to LCL and Index (top-left), you can find the entry for TPageControl and it tells you what unit it's in (top-right).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

OH1KH

  • Jr. Member
  • **
  • Posts: 67
Re: Error: Identifier not found "TPageControl"
« Reply #3 on: November 11, 2024, 05:04:47 pm »
Thanks for both!

Just what I though, I did not see that (did not understand to look at uses clause)
--
Saku

 

TinyPortal © 2005-2018