Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-03

Codebrowser, Search Identifier (was fpc-devel: procedure ... message(); in Linux)

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

Hi,

I moved this Lazarus related thread here from FPC-devel list.

Show quoted text 11 lines
Mattias G?rtner wrote: >> What gave no feedback? > > Ok, I tested again with a non-typical situation. > I worked with lazarus.lpi and built Lazarus from tools -> Configure Build > Lazarus. The error messages show up just like when compiling a "normal" > project but "search identifier" does nothing. I tested with lazarus.lpi: It works. Do you have english messages?

Yes, the problem was elsewhere.
The tool tries to find the source file in project directory, "lazarus/ide" in this case, but the problematic file was in "lazarus/converter" directory. When I created a similar problem in a file in ide directory, it worked as expected.

> Now I tested with a "normal" project and it works. It is a cool feature > actually. > I noticed a minor bug: the Scope combobox gets "Project" by default. If I > click the down-arrow to see a list then the first "Lazarus IDE" gets

selected

> automatically. I guess you forgot to set Combobox.ItemIndex and only set

its

> text. It didn't matter for me. I now set the ItemIndex. Does that fix it?

There seems to be again a difference between GTK2 and QT bindings behavior for combobox. I don't know which one is more correct though. QT version seems to select the item pointed by ItemIndex, GTK2 version does not.
Now it is worse than before because you set a wrong ItemIndex (I guess, didn't look at code). "Project" is the second item so ItemIndex should be 1 but it is apparently 0 instead and "Lazarus IDE" gets selected without touching anything. That is for QT version.
GTK2 version also shows "Lazarus IDE" hilighted when opening the list but doesn't select it unless you press enter.

Show quoted text 13 lines
> BTW, what does the Scope do? If I comment out SysUtils in my source, > it always finds the missing function under FCL, whatever scope I > select. That's the interesting difference between the codebrowser and a find declaration. Find declaration will search only via the uses sections and search paths. The codebrowser searches in whole packages and projects. That's why it can tell you in which unit an identifier is defined. If you set scope to 'project' it will search in all units of the project. If you check the 'with packages' it will search in all packages required by the project too. This normally includes the FCL package, so it will search in all units installed by FPC.

Right, thanks, now I understood the logic.
'with packages' is selected by default (which is good) and it always found FCL functions.

Regards,
Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100301/4eb77035/attachment-0001.html>

Reply by email

Mattias Gaertner
to Juha Manninen
Show quoted text 21 lines
Hi, I moved this Lazarus related thread here from FPC-devel list. > Mattias G?rtner wrote: >>> What gave no feedback? >> >> Ok, I tested again with a non-typical situation. >> I worked with lazarus.lpi and built Lazarus from tools -> Configure Build >> Lazarus. The error messages show up just like when compiling a "normal" >> project but "search identifier" does nothing. > > I tested with lazarus.lpi: It works. > Do you have english messages? Yes, the problem was elsewhere. The tool tries to find the source file in project directory, "lazarus/ide" in this case, but the problematic file was in "lazarus/converter" directory. When I created a similar problem in a file in ide directory, it worked as expected.

Fixed.

Show quoted text 17 lines
>> Now I tested with a "normal" project and it works. It is a cool feature >> actually. >> I noticed a minor bug: the Scope combobox gets "Project" by default. If I >> click the down-arrow to see a list then the first "Lazarus IDE" gets selected >> automatically. I guess you forgot to set Combobox.ItemIndex and only set its >> text. > > It didn't matter for me. I now set the ItemIndex. Does that fix it? There seems to be again a difference between GTK2 and QT bindings behavior for combobox. I don't know which one is more correct though. QT version seems to select the item pointed by ItemIndex, GTK2 version does not. Now it is worse than before because you set a wrong ItemIndex (I guess, didn't look at code).

I use
ScopeComboBox.Items.IndexOf

maybe IndexOf is buggy under qt? (I can't test qt at the moment)

Show quoted text 5 lines
"Project" is the second item so ItemIndex should be 1 but it is apparently 0 instead and "Lazarus IDE" gets selected without touching anything. That is for QT version. GTK2 version also shows "Lazarus IDE" hilighted when opening the list but doesn't select it unless you press enter.

My gtk2 theme does not show anything hilighted. I tried some others: none does.
What gtk2 theme do you use?

Mattias

Reply by email

Juha Manninen
to Mattias Gaertner

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

Reply by email

Juha Manninen
to Mattias Gaertner: On Mon, 1 Mar 2010 23:03:55 +0200 Fixed. I use ScopeComboBox.Items.IndexOf maybe IndexOf…

Hi,

My gtk2 theme does not show anything hilighted. I tried some others: none does. What gtk2 theme do you use?

GTK2 style is ClearLooks here. I can set it under KDE settings. Strange difference between our GTKs.

Anyway, the problem was not widget binding related this time. Both GTK2 and QT versions had logically the same problem although GTK2 version didn't select the item automatically.

Juha

Reply by email