[Lazarus] Alternative component palette layout

Giuliano Colla giuliano.colla at fastwebnet.it
Sat Dec 27 15:56:46 CET 2014


Il 27/12/2014 11:04, Juha Manninen ha scritto:
> On Fri, Dec 26, 2014 at 2:04 PM, Giuliano Colla
> <giuliano.colla at fastwebnet.it> wrote:
>
>> The patch has no effect, but I suspect that the problem is elsewhere,
>> because in my tests the TabControl.Pages.Move() is never called.
> That is not true.
> It is called from TComponentPage.InsertVisiblePage for any existing
> page that gets a new position index.
> Just debug it if you don't believe.

You are right. I found out that it depends on the difference between the 
old and the new layout. It's not called with my layout, it's called with 
yours. With my layout, it happens that the move performed in 
CreatePagesFromUserOrder is already the good one. Just a coincidence.

> You also wrote that you recreated the whole "modern" layout for your
> palette setup.
> It should not be needed. Non-existent components are skipped and you
> should be able to import any configuration. If you get an error during
> the import, then there is another bug.

It was just for testing purpose. I didn't get errors during the import 
of the "Modern" layout, I only had misplaced tabs with Qt. With my 
layout I didn't have misplaced tabs with the import, but I had when 
restoring the default. Just because of a slightly different order of tabs.

> I start to suspect you have local changes in your code which cause the errors.

svn diff doesn't show anything strange, and the only problem is with Qt 
ws, and in a very specific condition:
1) a number of tabs are added in the first positions (0,1,2 in one of my 
tests)
2) some are skipped because they are already in place (3,4,5,6 )
3) a new tab should be inserted just after those skipped (index = 7) and 
goes instead before them ( at position 3). Everything tells that it goes 
to index 7, up to TQtTabWidgetset.insertTab(), but it shows at index 3!
Then of course everything goes astray, because the tab index are out of 
sync.

I suspect that the problem arises from tab components being possibly 
shared by two widgets: I can see that at start, there are two InsertTab 
sequences: one with the number of visible tabs of the selected layout, 
and another one with all the tabs. It's possible that different 
widgetsets behave differently in this condition. My question is: is it 
necessary?

However I've found a simple workaround: with Qt ws, to remove the old 
tab before calling InsertVisiblePage. That way PageComponent is always 
nil, and everything works just fine.

If you agree, I can commit my change (it's really minimal) and you may 
check it.

Giuliano

-- 
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?





More information about the Lazarus mailing list