[Lazarus] Component palette GUI

Juha Manninen juha.manninen62 at gmail.com
Wed Dec 3 20:35:48 CET 2014


I send this to Lazarus list instead to developers only, in case
somebody has ideas for the remaining Windows issue. I am a little
exhausted already with this feature.
---

Component palette is a nasty beast but I think I tamed it for GTK2 and QT.
In the actual GUI generation part I had to call
Application.ProcessMessages; just after creating / deleting buttons
but before calling ReAlignButtons.
Otherwise ScrollBox.ControlCount of tabs was not updated.

Also in ReAlignButtons I had to call CustomPage.Invalidate in the end.
Otherwise I witnessed this behavior :
  http://bugs.freepascal.org/view.php?id=25470
It happened also with QT, not only with GTK2.

One thing I don't understand: how could it work earlier?
I only refactored the GUI generation parts and added debug info. I did
not really change the logic.
The bigger changes were in data structures not directly associated
with GUI drawing.
My only explanation is that the palette GUI code was called more often
and the next call somehow got the right values from widgetset.

Anyway, now it works for those 2 widgetsets. I have also fixed bugs
from the palette reorder feature.
Please test.

There is debug info written about "Additional" tab when Lazarus is
compiled with VerboseComponentPalette.
If somebody wants to test how leaving out the
Application.ProcessMessages affects, please follow these steps :
1. Comment out a call to Application.ProcessMessages, almost at the
end of TComponentPalette.CreateButtons.
2. Build Lazarus with VerboseComponentPalette.
3. Make a project with a normal form and a DataModule.
4. Switch focus between the form and the DataModule.
5. Notice how there is a gap between the 2 remaining buttons in
Additional page. Other pages have the same effect.
6. See debug output. When DataModule gets focus, all but 2 buttons are
removed, yet a loop in ReAlignButtons using ScrollBox.ControlCount
sees them all!

7. Uncomment the Application.ProcessMessages (from step 1) and repeat
steps 2 - 6. ScrollBox.ControlCount  works!

Now, uhhh, Windows bindings have another issue.
The filtering for DataModule does not switch off until the DataModule
is totally closed. Switching focus to other forms does not help.
In fact this very same behavior is explained here :
  http://bugs.freepascal.org/view.php?id=25224
Then nobody could reproduce and I resolved the issue. Now I believe
there was a hidden problem, not caused by me, which is now triggered
for some reason.

Juha




More information about the Lazarus mailing list