[Lazarus] Alternative component palette layout

Juha Manninen juha.manninen62 at gmail.com
Sun Dec 21 15:37:53 CET 2014


On Sun, Dec 21, 2014 at 1:35 AM, Giuliano Colla
<giuliano.colla at fastwebnet.it> wrote:
> It might be a timing issue. Sort of you tell Qt to do something on a new tab
> when it's not yet finished with the previous one. Actually the total number
> of tabs turns out to be less than expected. I've tested on a 32 bit dual
> core @1.33 GHz. I'm setting up a new platform 64 bit quad core @2.5 GHz. As
> soon as it's fully configured, I'll test there, and see if there's a
> difference.

I don't believe it is a timing issue, AFAIK we are dealing with a
single threaded code after all.
Is it a bug in QT component or LCL-QT, I don't know. According to my
debugging the palette code is correct, and indeed it works with other
widgetsets.

In fact I still have the same issue when importing the alternative
layout. Dialogs page is missing and the following pages are shifted.
Maybe it was wishful thinking that it got fixed completely.
I don't have any issue when restoring defaults though.


> Or if you point me to the proper section of code, I may add some delay from
> one item to the next, just for testing.

Delay will hardly work but Application.ProcessMessages could in theory
have an effect.

Palette is updated in TComponentPalette.UpdateNoteBookButtons.
The actual page and button layout is done in :
TComponentPage.InsertVisiblePage
TComponentPage.CreateButtons + the methods it calls,
TComponentPage.ReAlignButtons
etc.
CreateButtons is called from ReAlignButtons in a delayed way, but that
is not a cause for this problem.

In TComponentPage.CreateOrDelButton I tested
Application.ProcessMessages after the Btn.Parent := aScrollBox;, and
also in ComponentPalette.UpdateNoteBookButtons after
Pg.InsertVisiblePage.
No effect!

The layout code is originally from Mattias, I have mostly just refactored it.
It reuses existing pages and buttons. The logic was needed originally
for the DataModule filtering. Then some buttons are hidded and shown
again but their parent is not changed. For that purpose the code works
with QT, but according to my extensive debugging it should work for
the palette ordering feature, too.
The code is optimixed, pages and buttons are destroyed / created only
when needed.

If you find a workaround, great!
The ultimate workaround would be to destroy and recreate everything
just like when the IDE starts.
Another choice would be to use a special custom pagecontrol instead of
the LCL pagecontrol.

Remember to compile with VerboseComponentPalette and look at the console output.
Debugging with GDB from another Lazarus instance is difficult because
using mouse for palette may cause all mouse actions to get blocked.

Juha




More information about the Lazarus mailing list