[Lazarus] Codebrowser, Search Identifier

Juha Manninen juha.manninen at phnet.fi
Tue Mar 2 13:11:49 CET 2010


Hi,

> I use
> ScopeComboBox.Items.IndexOf
> maybe IndexOf is buggy under qt? (I can't test qt at the moment)

I debugged the code and found the problem.

SetScopeToCurUnitOwner is called before FillScopeComboBox. Thus the list is 
empty when first setting ScopeComboBox.Text and ItemIndex is not set.

Later FillScopeComboBox fills the list.
There ScopeComboBox.Text returns the first item 'Lazarus IDE'. Somehow it got 
confused from setting a text not in the list.

The fix is to call FillScopeComboBox before setting the text.
Other fix is to make a condition for filling the list in FillScopeComboBox.
It seems to get called "all the time" from an event handler but filling the 
list once is enough.

The code still looks little suspicious. FillScopeComboBox uses const 
ProjectDescription for the second item.
Then SetScopeToCurUnitOwner calls GetScopeToCurUnitOwner for the same thing. 
It happens to return the same string but what happens if it returns something 
else? Maybe it works OK, I didn't study the code further.

I fixed the code in 23824. Please check.


BTW, many developers have complained about debug support in Lazarus.
In fact I am quite happy with it. Breakpoints work perfectly and I can inspect 
most of the variables. Only property values (like List.Count) are not 
available which is a pitty.  Also function result of type string sometimes 
shows garbage.
I can see the call history and browse it and I can step code line by line 
after a breakpoint. I couldn't do those things with DebugLn() calls which are 
ugly anyway and add noise to the code and slow it down also when not 
debugging.
Actually I have removed DebugLn() calls from the converter code I am working 
on.


Regards,
Juha




More information about the Lazarus mailing list