Forum > Designer
Bugs in Example Projects window
JuhaManninen:
As already mentioned in "Juggling Multiple Lazarus Projects" thread, for me the Example Projects window shows an empty list.
Mysteriously the list is filled when Lazarus is started with a clean configuration. Then after opening any project the list is empty again. This is especially weird as a project's settings should not affect example project management anyhow. It only uses info from the global settings.
My system:
Manjaro Linux (any Linux should do, this bug is only about paths)
Lazarus is built from sources in Git development "main" branch, pulled into directory ~/SW/lazarus (/home/juha/SW/lazarus).
Lazarus is started as "./lazarus &" directly from the source directory.
Example Projects has an option "Directory where Examples go". Its value is : /home/juha/.lazarus/examples_work_dir/
which is correct although it is irrelevant for this bug.
To reproduce :
1. Start Lazarus with a clean configuration, either by --pcp= parameter or by deleting the default config directory (~/.lazarus).
2. Open the Tools -> Example Projects window. The list is filled.
3. Close the Example Projects window. Open ide/lazarus.lpi (or any other project).
4. Open the Example Projects window again. The list is empty.
An alternative step 3.: Open one of the example projects from the window. It opens OK. Then continue with step 4.
Can anybody else reproduce?
There was an issue with the example project path also earlier.
I changed the EnvironmentOptions in commit 9f142eef but had to revert it in commit 9f142eef. See issue :
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39671
However opening a project does not affect EnvironmentOptions. This bug is different.
Another issue:
The search or filter edit control sucks. It shows the "Search Here" text also when it gets focus. A user must delete the text first. A TListViewFilterEdit control should be used instead. It is designed for exactly this purpose.
To see it in action, open in Lazarus IDE: Package -> Open Loaded Package ...
It also supports browsing the list with arrow keys while the filter edit has focus.
JuhaManninen:
It is caused by the global LazarusDirectory setting after all. In Environment options "Lazarus directory (default for all projects)".
At least here it is a relative path always : "../SW/lazarus/". If I try to change it to an absolute path, it gets saved as relative again.
The path is wrong. My current directory is "~/SW/lazarus/". Expanding "../SW/lazarus/" then makes "~/SW/SW/lazarus/".
Adding "Exit('/home/juha/SW/lazarus/');" as a first line in function TExampleData.GetLazDir makes the examples window work.
Earlier (issue #39671) I tried to change the logic for this exact same LazarusDirectory but it caused a regression.
Must study this more ...
[Edit]
I fixed it in commit e723acfe03. Reading LazarusDirectory directly from config XML file was a bad idea. The options interface provides function GetParsedLazarusDirectory which returns the correct path.
I don't know why it is stored in the config file in such a strange way.
I still wonder why nobody else noticed this problem.
[Edit2]
The path is relative to defaultGetPrimaryConfigPath, by default "~/.lazarus", where the environmentoptions.xml is stored.
dbannon:
Juha, there was a reason why I had to resort to reading the path from the config file, it was definitely not something I wanted to to do, it pulled in xml reading stuff and added quite a lot of code.
I cannot remember why it was done, maybe, tomorrow, I will go back over the forum posts and see what it was ....
Davo
Aruna:
--- Quote from: JuhaManninen on December 05, 2022, 08:56:55 am ---Another issue:
The search or filter edit control sucks. It shows the "Search Here" text also when it gets focus. A user must delete the text first. A TListViewFilterEdit control should be used instead. It is designed for exactly this purpose.
To see it in action, open in Lazarus IDE: Package -> Open Loaded Package ...
It also supports browsing the list with arrow keys while the filter edit has focus.
--- End quote ---
Juha please have a look at this, we already have this functionality built in to TListBox: TListBox built-in search+filter functionality
wp:
--- Quote from: JuhaManninen on December 05, 2022, 08:56:55 am ---The search or filter edit control sucks. It shows the "Search Here" text also when it gets focus. A user must delete the text first.
--- End quote ---
Such a hint text should not be stored in the Edit.Text itself but in the Edit.TextHint which is displayed in grayed-out style as long as Edit.Text is empty (https://lazarus-ccr.sourceforge.io/docs/lcl/stdctrls/tcustomedit.texthint.html).
Navigation
[0] Message Index
[#] Next page