Recent

Author Topic: [Solved] Height of TLabel inside custom TPanel  (Read 1669 times)

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
[Solved] Height of TLabel inside custom TPanel
« on: April 09, 2018, 09:23:16 pm »
Hi, my custom control is located here
https://github.com/Arandusoft/fpcpaymowidget/tree/master/controls

As well as a simple test project
https://github.com/Arandusoft/fpcpaymowidget/tree/master/controls/test_autocomplete

Is an autocomplete control that uses a Label, an Edit and a ListBox.

What I need is to know the height of the Label in the Create event of the component (https://github.com/Arandusoft/fpcpaymowidget/blob/master/controls/autocompletepanel.pas#L166):

Code: Pascal  [Select][+][-]
  1. FLabel.Height

Because I set the height of the component based on
Code: Pascal  [Select][+][-]
  1. Height := FLabel.Height + FEdit.Height;

But seems that FLabel.Height is not known in the Create event yet. And also there is no Canvas available to at least try to measure the height.

It's a bug? There is a way to get the Label height on Create?

Thanks.
« Last Edit: April 09, 2018, 09:49:56 pm by lainz »

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: Height of TLabel inside custom TPanel
« Reply #1 on: April 09, 2018, 09:49:42 pm »
Solved.

It was that I did not call:
Code: Pascal  [Select][+][-]
  1. SetInitialBounds(0, 0, 200, FLabel.Height + FEdit.Height);

But height of label is available, maybe I get confused by not rebuilding the IDE?  :-[

 

TinyPortal © 2005-2018