[Lazarus] TFrame improvements
lazarus at kluug.net
Tue Nov 30 07:23:02 CET 2021
On 30.11.2021 00:27, Juha Manninen via lazarus wrote:
> On Mon, Nov 29, 2021 at 11:14 PM Ondrej Pokorny via lazarus
> <lazarus at lists.lazarus-ide.org <mailto:lazarus at lists.lazarus-ide.org>>
> On 29.11.2021 17:18, Juha Manninen via lazarus wrote:
>> The commit message is not perfect but the committed code is, now
>> that I fully understand the issue.
> That is nonsense. I reverted your change. The code user code is
> just plain wrong and your change in TFrame doesn't change anything
> about it.
> No, the code is valid although not recommended. Accessing Canvas
> outside Paint works with some widgetsets and then an exception is wrong.
No, Juha, you don't understand the issue at all.
Accessing Canvas outside Paint is OK under all widgetsets if done
correctly. Whenever you access the canvas for text measuring you have to
make sure you can do so. There are 2 solutions for it:
1.) Check HandleAllocated and skip the measurements if the handle is not
allocated. Like here:
- or -
2.) If you really have to do the measurements and return something,
create an extra handle for the canvas like in TCustomLabel.CalculateSize.
The LCL's function is not to force creating the canvas when it cannot be
naturally created with manipulating itself like you did.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lazarus