[fpc-pascal] How to make TCheckBox autosize work correctly on Linux?

Martin Wynne martin at 85a.uk
Wed Jan 7 00:50:43 CET 2026


On 06/01/2026 23:15, Bo Berglund via fpc-pascal wrote:
> Did not work:
> 
> Error: Identifier not found "ControlCanvas"
> 
> Where is this item declared?

Sorry, that was Delphi code for Windows. In Lazarus for cross-platform 
do this:

uses
   LCLIntf;

var
   w,h:integer;

begin
   with checkbox do begin
    AutoSize:=False;
    Caption:='new text';
    GetTextSize(Font,Caption,w,h);
    Width:=w+30;
   end;


Martin.


More information about the fpc-pascal mailing list