Lazarus

Using the Lazarus IDE => Designer => Topic started by: JuhaManninen on December 05, 2022, 08:56:55 am

Title: Bugs in Example Projects window
Post by: JuhaManninen on December 05, 2022, 08:56:55 am
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.
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 05, 2022, 10:36:37 am
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.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 05, 2022, 01:39:16 pm
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
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 05, 2022, 02:50:01 pm
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.
Juha please have a look at this, we already have this functionality built in to TListBox: TListBox built-in search+filter functionality (https://youtu.be/PfuiRoJxpc8)
Title: Re: Bugs in Example Projects window
Post by: wp on December 05, 2022, 04:27:02 pm
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.
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).
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 05, 2022, 06:53:04 pm
Juha please have a look at this, we already have this functionality built in to TListBox: TListBox built-in search+filter functionality (https://youtu.be/PfuiRoJxpc8)
No we don't. Please see my answer in the other thread. Why do you call it search+filter functionality while it is only a search?
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 05, 2022, 09:51:25 pm
Juha please have a look at this, we already have this functionality built in to TListBox: TListBox built-in search+filter functionality (https://youtu.be/PfuiRoJxpc8)
No we don't. Please see my answer in the other thread. Why do you call it search+filter functionality while it is only a search?
I thought it was both but I guess I was wrong :-(
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 05, 2022, 11:41:03 pm
===== LazarusDirectory ======
Earlier (issue #39671) I tried to change the logic for this exact same LazarusDirectory but it caused a regression.
You told me you had fixed it. And from memory, it needed to be fixed. But you did not tell me you reverted that fix.  Thanks very much.

background : Initially, direct access to LazarusDirectory was not available, Getmen eventually either found a way or made a way but by that stage, my code was in the review pipeline.
https://forum.lazarus.freepascal.org/index.php/topic,57680.msg434967.html#msg434967
Clearly I should have gone back to it but I was traveling then and time was a rare commodity. But with a fix applied to the LazarusDirectory name issue, it was not critical.  :-[

I still wonder why nobody else noticed this problem.
Well, in my case I am not using trunk for day to day work anymore because of this https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39540
The problem only shows up if you are using the default location for PCP. Most trunk users have it as a second install and its config is redirected. Certainly in my case.

======= Search Prompt ========
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).

yes, Martin_fr also mentioned textHint. I quote its extensive documentation -
TextHint fills the TCustomEdit with the value assigned to it, whenever the control's Text property is empty and the control does not have focus.

When the Example Window opens, I want the EditSearch to have Focus. Its the component the end user is most likely to want to use. But when an Edit control has Focus, the TextHint is not shown.

I also found using TextHint seemed to introduce some quite unexpected instabilities. Further research is indicated.

So, I coded the equivalent myself. This is the way most other systems work these days. The 'hint' is show until the user starts typing, on the first press of a character, the Prompt is removed. https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40034.  This would a lot more intuitive if I could get that Prompt to be automatically selected when the user clicks back into the control but selecting it in OnEnter fails, I am still trying to find out why.

I think I will make a small dummy app just demonstrating TEdit and see where that leads.

Davo

 
Title: Re: Bugs in Example Projects window
Post by: wp on December 06, 2022, 12:17:25 am
But when an Edit control has Focus, the TextHint is not shown.
Yes, this is in the docs, but in fact, the TextHint IS shown for the focused Edit on Windows and cocoa. This is different from Delphi. The TextHint is not shown on gtk2/gkt3, though (did not not test the qt's). It would be better if we'd have a consistent behaviour here.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 06, 2022, 12:56:14 am
But when an Edit control has Focus, the TextHint is not shown.
Yes, this is in the docs, but in fact, the TextHint IS shown for the focused Edit on Windows and cocoa. This is different from Delphi. The TextHint is not shown on gtk2/gkt3, though (did not not test the qt's). It would be better if we'd have a consistent behaviour here.
Thanks WP.
Yes, thats what I have found although only tested on GTK2, Qt5 and Windows so far. Qt5 is OK too so its "only" a GTK2/3 issue.

So, I have some workable code but I am not exactly happy with it. Have to support GTK and drag the others down (or ifdef all over the place).

To make it usable in GTK2/GTK3, IMHO, I need to alter the tab order, have initial focus on the ListView (so the texthint shows) and first tab stop after that is the EditSearch. Thats fine so far, maybe even reasonably intuitive. But then tabbing back to the ListView (from the EditSearch) is hopeless if you have all the checkboxes and buttons as tabstop.

(Please look away now Aruna)
Does anyone seriously try and use these interfaces without a mouse ? Or choose tabbing rather than clicking 'cos its faster ? Using the mouse is flawless.

Anyway, I will graft this new model into my full test install and see if I like it, if I do, I will push another patch up in place of the previous one. Maybe later today unless someone has a better approach to suggest.

Right now, I need to go out and cut some firewood before it gets too hot.

Davo
Title: Re: Bugs in Example Projects window
Post by: dsiders on December 06, 2022, 02:30:27 am
But when an Edit control has Focus, the TextHint is not shown.
Yes, this is in the docs, but in fact, the TextHint IS shown for the focused Edit on Windows and cocoa. This is different from Delphi. The TextHint is not shown on gtk2/gkt3, though (did not not test the qt's). It would be better if we'd have a consistent behaviour here.
Thanks WP.
Yes, thats what I have found although only tested on GTK2, Qt5 and Windows so far. Qt5 is OK too so its "only" a GTK2/3 issue.

So, I have some workable code but I am not exactly happy with it. Have to support GTK and drag the others down (or ifdef all over the place).

To make it usable in GTK2/GTK3, IMHO, I need to alter the tab order, have initial focus on the ListView (so the texthint shows) and first tab stop after that is the EditSearch. Thats fine so far, maybe even reasonably intuitive. But then tabbing back to the ListView (from the EditSearch) is hopeless if you have all the checkboxes and buttons as tabstop.

(Please look away now Aruna)
Does anyone seriously try and use these interfaces without a mouse ? Or choose tabbing rather than clicking 'cos its faster ? Using the mouse is flawless.

Anyway, I will graft this new model into my full test install and see if I like it, if I do, I will push another patch up in place of the previous one. Maybe later today unless someone has a better approach to suggest.

Right now, I need to go out and cut some firewood before it gets too hot.

Davo

I looked at the GTK docs. They call them "placeholders", and they do not exist in GTK2 (that I could find). It was introduced in GTK 3.2.

GTK3 is not working because there is no setter implemented for the value. It is even comment as such in the GTK3 bindings. I would file a bug report.

For GTK2, if they did not see fit to implement it - just assign a Hint for the edit control. No need to drag everyone else down because they gave up on GTK 2.

My $.02USD...
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 06, 2022, 02:46:55 am
(Please look away now Aruna)
Does anyone seriously try and use these interfaces without a mouse ? Or choose tabbing rather than clicking 'cos its faster ? Using the mouse is flawless.
Davo, listen to me please. The way 'I' see it 'anything' we design and develop will have two human interface devices connected, the keyboard and that mouse correct? All I am saying is whatever one is able to do by pointing and clicking the mouse one should also be able to do using the keyboard. If you are unable to do so to me that is a serious design flaw that needs to be reviewed and rectified.

Think about this. Let's say you are in the middle of the monthly payroll and that mouse decides to die on you.  The most frustrating thing is being in the middle of a payroll run and not being able to click that button using the keyboard to initiate printing payslips.  Consequently, no one gets paid and we have a riot on our hands. Now you see why it is important to have the keyboard be able to do at least the critical things that the mouse is used for. This happened long years ago in Sri Lanka when I was the Data Processing Manager at Blanka Diamonds. I had to rapidly put together a separate module to print the payslips using Clipper+dos lots of fun belive me 900 plus female employees at a Diamond factory were not pleased nor were they willing to wait until the next day. It was a Belgian operation.

Oh btw, I am sulking. First I screwed up by not realizing the example code widows was using a TListView and not a TListBox then I forgot the behaviour I was seeing was native to my gtk2/3 and might not work across all other platforms. Juha set me straight. Then I responded to a docking issue question only to be later enlightened the issue was with the embedded designer and another package was now available. Again Juha pointed this out diplomatically. So now I am sulking. I should have read that second docking issue question twice over carefully but in my haste, I screwed up. Lesson learnt.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 06, 2022, 04:00:39 am

@dsiders - thanks for that. I think the draft I have now is quite usable by all parties except mouse-less users who could muddle through in an emergency. Its not how I would do it it if I was not supporting GTK2 but its not too bad.

All I am saying is whatever one is able to do by pointing and clicking the mouse one should also be able to do using the keyboard.

The issue is not 'able', my current draft will allow you to recover. But its not nice, you need to look very closely to see which component is currently on focus, the checkbox show a small difference as do the buttons. The list view on the other hand has no visible change as it gains focus if a row is already selected. Its definitely not usable on a day to day basis. Thats a GTK2 issue, not my code, not Lazarus.

An alternative way to work would be to unselect a row in the TListView onExit method, then, when you tab back to the ListView, you see a "half highlight" on the last row selected. Unfortunately, while the user can see it, I cannot find out which row it is programmatically. The user has every right to expect an Enter to activate the "half selected" row but thats not possible.

I believe this "half highlight" thing is a bug and will investigate further. I have unsuccessfully tried things at onExit like
Code: Pascal  [Select][+][-]
  1.      ListView1.ClearSelection;
  2.      ListView1.ItemIndex := -1;
   

In the mean time, to avoid that problem, I force the selection of the first row onEnter - "half highlights" are then cancelled and the user will get what they see if they press Enter then. No surprises. And if they have a suddenly broken mouse, and are very careful and observant, they could continue. But it would be stupid to do so.

....... I forgot the behaviour I was seeing was native to my gtk2/3 .....
Are you referring to the failure to Search While You Type you reported ?  Thats not a gtk2 thing, I do all my dev on gtk2, test on several different platforms, always works for me. I think you are using  six or seven month old source.

Davo
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 06, 2022, 04:11:20 am
Oh, so, so annoying.

As I pressed 'Send' for that last message, I realised how easy it is to solve that problem. In the ListView1.onExit, I record its ItemIndex in a 'regional' var, when we tab back in I restore it.

I cannot believe I looked at this for so long without realising there was such an easy fix !

(I still think this "half highlight" thing is a bug, will chase it down.)

Davo
Title: Re: Bugs in Example Projects window
Post by: dsiders on December 06, 2022, 09:17:44 am
But when an Edit control has Focus, the TextHint is not shown.
Yes, this is in the docs, but in fact, the TextHint IS shown for the focused Edit on Windows and cocoa. This is different from Delphi. The TextHint is not shown on gtk2/gkt3, though (did not not test the qt's). It would be better if we'd have a consistent behaviour here.

Help topics for TextHint have been updated in commits 901b01e6 and ac088cfc. The updated content is on the documentation preview at:

https://dsiders.gitlab.io/lazdocsnext/lcl/stdctrls/tcustomcombobox.texthint.html
https://dsiders.gitlab.io/lazdocsnext/lcl/stdctrls/tcustomedit.texthint.html
https://dsiders.gitlab.io/lazdocsnext/lcl/groupededit/tcustomabstractgroupededit.texthint.html
https://dsiders.gitlab.io/lazdocsnext/



Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 06, 2022, 09:32:51 am
Earlier (issue #39671) I tried to change the logic for this exact same LazarusDirectory but it caused a regression.
You told me you had fixed it. And from memory, it needed to be fixed. But you did not tell me you reverted that fix.  Thanks very much.

background : Initially, direct access to LazarusDirectory was not available, Getmen eventually either found a way or made a way but by that stage, my code was in the review pipeline.
https://forum.lazarus.freepascal.org/index.php/topic,57680.msg434967.html#msg434967
Clearly I should have gone back to it but I was traveling then and time was a rare commodity. But with a fix applied to the LazarusDirectory name issue, it was not critical.  :-[
My "fix" was based on poor knowledge of the code. After reverting it I planned to study the issue more but I had many other activities during the past year and this one got postponed.
Now it is fixed. No worries mate, or how they say in Australia?
I started to wonder when was function GetParsedLazarusDirectory added to the interface. Why didn't we find it earlier? I did :
Code: [Select]
$ git blame components/buildintf/ideoptionsintf.pasThis is a portion of its output :
Code: [Select]
151f452c847 components/ideintf/ideoptionsintf.pas   (ondrej  2015-11-27 05:35:22 +0000 135)     procedure RemoveFromRecentPackageFiles(const AFilename: string); virtual; abstract;
151f452c847 components/ideintf/ideoptionsintf.pas   (ondrej  2015-11-27 05:35:22 +0000 136)
68276150e12 components/ideintf/ideoptionsintf.pas   (joost   2019-01-01 16:49:20 +0000 137)     function GetParsedCompilerFilename: string; virtual; abstract;
9d1b8c9d875 components/ideintf/ideoptionsintf.pas   (joost   2019-04-12 21:08:55 +0000 138)     function GetParsedFppkgConfig: string; virtual; abstract;
6f9144a5841 components/buildintf/ideoptionsintf.pas (balazs  2022-02-23 08:04:33 +0200 139)     function GetParsedLazarusDirectory: string; virtual; abstract;
fba579ac625 components/ideintf/ideoptionsintf.pas   (mattias 2018-09-22 12:03:45 +0000 140)
151f452c847 components/ideintf/ideoptionsintf.pas   (ondrej  2015-11-27 05:35:22 +0000 141)     procedure AddHandlerAddToRecentOpenFiles(Handler: TOnAddToRecent; const AsFirst: boolean = true); // AsFirst means: first to call
151f452c847 components/ideintf/ideoptionsintf.pas   (ondrej  2015-11-27 05:35:22 +0000 142)     procedure RemoveHandlerAddToRecentOpenFiles(Handler: TOnAddToRecent);
It was added by balazs in February this year. Kudos to him. [I got confused by names and had an inaccurate comment here for a while]
BTW, the "git blame" command is super. The whole file was moved from ideintf to buildintf (removing LCL dependency) and Git is able to track it without being told about the move. It calculates a "similarity index" and understands that identical or near identical files are moved or copied.
Also the merge conflict algorithms in Git are very good. The more demanding task you have, the better it works.

Quote
Well, in my case I am not using trunk for day to day work anymore because of this https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39540
Yes, it must be fixed properly. Now it does not crash any more but the popup opens in a wrong place.
Quote
The problem only shows up if you are using the default location for PCP. Most trunk users have it as a second install and its config is redirected. Certainly in my case.
PCP is "Primary Config Path". The bug happened also when using --pcp= parameter.
I think I know why others didn't notice it! The few people who are testing the Examples window in Lazarus "main" have their sources in a directory right under their home directory, like "~/lazarus_git". LazarusDirectory is stored as a path relative to PCP which by default is "~/.lazarus". By accident it went right.
My sources are in "~/SW/lazarus" and things went haywire. How does it work on Windows? I have no idea.
The global options GUI needs a hint of how LazarusDirectory is stored. I will add it ...  [Edit] Done in 2f13102566

About the filter :
It is OK if TextHint is not shown when the filter has focus. It is widgetset specific behavior. TextHint is shown when focus is elsewhere. It is logical and users learn it in few seconds. Please don't waste your time tweaking LCL's behavior. If LCL widgetset code has a bug, it should be fixed there.
I added a comment in issue
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40034
You still haven't commented on using the TListViewFilterEdit control.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 06, 2022, 10:46:36 am
.....After reverting it I planned to study the issue more but I had many other activities during the past year and this one got postponed.
Quite a lot of activities I understand. Outside ... :)
Its good to see you back here, hands on again. Hope you don't mind me saying.

Now it is fixed. No worries mate, or how they say in Australia?
If you can draw the 'a' in mate out a bit, maaaate .....

[I deleted a piece here because I had confused names badly and the this would confuse things more. Sorry! _Juha_]

Quote
PCP is "Primary Config Path". The bug happened also when using --pcp= parameter.

Oh, I did not realise that, I thought any redirection of PCP masked the problem. So, is it because of the '~' rather than an absolute path ?  I usually use $HOME rather than tilde because sometimes the shell plays with '~' in unexpected ways. Its managed internally rather than expanded like $HOME is.

Anyway, even though its no longer a problem here, I suspect it needs to be resolved, it will bite us again, sooner or later.

Quote
About the filter :
It is OK if TextHint is not shown when the filter has focus.
Its OK now with the patch I posted a few hours ago. The issue for me was that a user seeing the window for the first time had no way of knowing just what that field was for. Now I start with the focus on the ListView (and thats actually good), the EditSearch is only a click or a tab away and an Enter in the EditSearch brings you back into the ListView. Its actually quite intuitive.

Quote
I added a comment in issue
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40034
You still haven't commented on using the TListViewFilterEdit control.
I'll respond to issue 40034 in Isue 40034, my bad !
 TListViewFilterEdit  ? Probably another very good component with no documentation. Every time I want to use a new component, I have to spend days experimenting on how it works (and writing up my finding in the wiki) so, I use the ones I know.  Its really sad we have such great people writing such good code but they won't add an extra 15 minutes documenting what they have done !  (Get off your soap box David, he used to be in a position to 'instruct' his developers to write good docs but not any more.)

OK, off to issue 40034 ...

Davo

 
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 06, 2022, 12:18:31 pm
Oh, I did not realise that, I thought any redirection of PCP masked the problem. So, is it because of the '~' rather than an absolute path ?  I usually use $HOME rather than tilde because sometimes the shell plays with '~' in unexpected ways. Its managed internally rather than expanded like $HOME is.
'~' is interpreted by a (bash) shell and works just fine there.
Now the problem was a relative '..' path in LazarusDirectory. It is relative to the Primary Config Path which was not obvious. I improved the situation by adding a hint to the options GUI.

Quote
Anyway, even though its no longer a problem here, I suspect it needs to be resolved, it will bite us again, sooner or later.
It is now resolved properly!
Earlier you had to read the XML file because there was no API function for the task. Now there is because GetMem (balasz) added it. GetParsedLazarusDirectory resolves the relative path correctly.

Quote
Its OK now with the patch I posted a few hours ago. The issue for me was that a user seeing the window for the first time had no way of knowing just what that field was for. Now I start with the focus on the ListView (and thats actually good), the EditSearch is only a click or a tab away and an Enter in the EditSearch brings you back into the ListView. Its actually quite intuitive.
Not good. Sorry.
People understand what a FilterEdit is because it is spread everywhere in the IDE. The convention is to give focus to it first. It has become a standard GUI element in many other systems, too. For example KDE which I use as a Linux desktop shines with that. Their comprehensive settings dialog is a pleasure to use because of its filter edits.
In fact I got inspiration years ago to create the FilterEdit controls for Lazarus from using KDE.

Quote
TListViewFilterEdit  ? Probably another very good component with no documentation.
Yes.  :)
... no, it has documentation:
 https://wiki.freepascal.org/LazControls#TListViewFilterEdit
OK, it is rather short but it says "Data should be added to TListViewFilterEdit.Items, not to the container ListView."
What else you need to know?  :P
There is example code in Lazarus sources.

Quote
Every time I want to use a new component, I have to spend days experimenting on how it works (and writing up my finding in the wiki) so, I use the ones I know.  Its really sad we have such great people writing such good code but they won't add an extra 15 minutes documenting what they have done !  (Get off your soap box David, he used to be in a position to 'instruct' his developers to write good docs but not any more.)
Example code works as documentation, too.
Anyway, when working with a huge existing code base the biggest challenge is not writing new code but learning the existing code.
Title: Re: Bugs in Example Projects window
Post by: balazsszekely on December 06, 2022, 01:02:28 pm
Two suggestion, if I may:
1. FormLazExam's postion property should be poWorkAreaCenter instead of poDesigned for obvious reasons
2. Pressing the Esc key should close the dialog, this is universally true for almost every other dialog in the IDE
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 06, 2022, 01:08:15 pm
TListViewFilterEdit  ? Probably another very good component with no documentation.
Yes.  :)
... no, it has documentation:
 https://wiki.freepascal.org/LazControls#TListViewFilterEdit
OK, it is rather short but it says "Data should be added to TListViewFilterEdit.Items, not to the container ListView."
What else you need to know?  :P
* Can it handle multiple columns in the list view ? 
* How to add an item ?  Seems its a call to ~.items.add(Item:T); And that item is fgl thingo. I use Pascal because its strongly typed, if I want something that can be any old type depending on the day of the week, I'd use Python.
* How to specify and apply the filter ?
* Can you filter for, eg "Words together" plus another ?
* Will it work with Owner Data ?
* Why does it have no mention in the chm help files ?
* Why is it Red on in the table that appears, eg on https://wiki.freepascal.org/TEdit ?
* Why is there no Example Project showing how to use TListViewFilterEdit ?

Honestly, before I answer half of those questions, I've written the filter that I used. And it works fine. I'm willing to consider any other model iff that model is better.
 
Quote
Anyway, when working with a huge existing code base the biggest challenge is not writing new code but learning the existing code.

Sure, that I agree. See the last three questions above.

Anyway, do as you see fit, you have commit rights, I don't.  :)

Davo
Title: Re: Bugs in Example Projects window
Post by: balazsszekely on December 06, 2022, 02:34:08 pm
@dbannon

ListViewFilterEdit has a FilteredListView property, once the link is set you are good to go, no additional code is required. I did not study you custom filtering, maybe is more advanced then what ListViewFilterEdit natively provides, the important thing is don't get too upset about these small issues.  I played the same game with OPM, it can be really frustrating and it's not worth it.
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 06, 2022, 09:19:19 pm
I did experiments with ListViewFilterEdit in the Examples window. It cannot be applied there easily. The current SearchEdit is tightly integrated to the actual search engine, and it supports many keywords at once.

I applied the patch with some additions. The TextHint looks good although I would like to have the initial focus in the filter.
You could add small SpeedButton to the right side of the edit for clearing the filter. It should have the same icon as other filters, a funnel with a red cross (btnfiltercancel).
Title: Re: Bugs in Example Projects window
Post by: dsiders on December 06, 2022, 09:39:00 pm
TListViewFilterEdit  ? Probably another very good component with no documentation.
...

* Can it handle multiple columns in the list view ? 
* How to add an item ?  Seems its a call to ~.items.add(Item:T); And that item is fgl thingo. I use Pascal because its strongly typed, if I want something that can be any old type depending on the day of the week, I'd use Python.
* How to specify and apply the filter ?
* Can you filter for, eg "Words together" plus another ?
* Will it work with Owner Data ?
* Why does it have no mention in the chm help files ?
* Why is it Red on in the table that appears, eg on https://wiki.freepascal.org/TEdit ?
* Why is there no Example Project showing how to use TListViewFilterEdit ?

There is documentation, but it is not included in the release files nor is it integrated into the LHelp help system. It can be found on the documentation preview at: https://dsiders.gitlab.io/lazdocsnext/lazcontrols/listviewfilteredit/tlistviewfilteredit.html.
Title: Re: Bugs in Example Projects window
Post by: balazsszekely on December 06, 2022, 10:23:24 pm
@JuhaManninen

1. When down key is pressed in SearchEdit, the listview should get focus with the first item selected(sorry it's too late, I don't have time for a patch):
Code: Pascal  [Select][+][-]
  1. procedure TFormLazExam.EditSearchKeyDown(Sender: TObject; var Key: Word;
  2.     Shift: TShiftState);
  3. begin
  4.     if Key = VK_RETURN then begin
  5.         key := 0;
  6.         if ListView1.items.Count > 0 then
  7.             ListView1.SetFocus;
  8.     end
  9.     else if Key = VK_DOWN then begin //begin change
  10.       ListView1.SetFocus;
  11.       if ListView1.Items.Count > 0 then
  12.       begin
  13.         ListView1.Selected := ListView1.Items[0];
  14.         ListView1.ItemFocused := ListView1.Items[0];
  15.       end;
  16.     end                            // end change
  17.     else if Key = VK_ESCAPE then
  18.         ModalResult := mrClose;
  19. end;

2. BeginUpdate/EndUpdate would prevent flickering when updating the ListView
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 07, 2022, 07:43:09 pm
1. When down key is pressed in SearchEdit, the listview should get focus with the first item selected(sorry it's too late, I don't have time for a patch):
I will add your suggestions to the code later.
Now a related question: Why is the Example form KeyDown handler not triggered?
Code: Pascal  [Select][+][-]
  1. procedure TFormLazExam.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  2. begin
  3.     if Key = VK_ESCAPE then
  4.         ModalResult := mrClose;
  5. end;
  6.  
I had to add VK_ESCAPE handling to all controls that get focus. Normally the key should be passed to a parent form if not processed by a control.
I checked some other IDE forms and they work with just a form's KeyDown handler.

The "Close" button in Examples window now has its ModalResult property set to mrClose.
A KeyDown handler setting ModalResult := mrClose works when it is actually called but the form's KeyDown is not called.

To add to the confusion, the above FormKeyDown handler is now also reused for Memo1. There it works.
Title: Re: Bugs in Example Projects window
Post by: balazsszekely on December 07, 2022, 08:12:58 pm
@JuhaManninen
Quote
Now a related question: Why is the Example form KeyDown handler not triggered?
Most likely the KeyPreview property of the form is false.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 08, 2022, 01:18:16 am
OK, where it does not work is in the Category CheckBoxes and the row of buttons across the bottom.

The CheckBoxes are created dynamically (to allow auto support for new Categories) so I added a test for VK_ESCAPE to the panel they sit on and that now works fine.

I don't understand why the key stroke is not being passed up from the buttons however. So, I have added a OnKeyDown for the buttons and that does seem to work. Not sure why its necessary.

I also think GetMem's idea of a keystroke moving focus from listview to editsearch is a good one, I have implemented that too. Need to exclude tabs and arrow keys, I hope there are not more things to exclude, maybe different keyboard layouts will be an issue ?

I will open a new Issue and attach patch there.

And please forgive my apparent petulance a few days ago, I was having a bad day but nothing to do with either Lazarus or the good people here.

Davo



Title: Re: Bugs in Example Projects window
Post by: dbannon on December 08, 2022, 01:49:43 am
OK, https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40036

Now ESC closes window from everywhere (?) and GetMem's two suggestions implemented (beginupdate and a keypress moves from listview to editsearch).

Sorry this project has needed so much attention, despite my enthusasim to tackel it, evidence is it was beyond me. Still, I think its OK now but will not, in any way be offended if its decided to drop it.

Reverting back to old Example Window in the IDE would be easy, a global find and remove of *.ex-meta files easy too.

Davo
Title: Re: Bugs in Example Projects window
Post by: balazsszekely on December 08, 2022, 11:48:37 am
OK, https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40036

Now ESC closes window from everywhere (?) and GetMem's two suggestions implemented (beginupdate and a keypress moves from listview to editsearch).

Sorry this project has needed so much attention, despite my enthusasim to tackel it, evidence is it was beyond me. Still, I think its OK now but will not, in any way be offended if its decided to drop it.

Reverting back to old Example Window in the IDE would be easy, a global find and remove of *.ex-meta files easy too.

Davo
Reverting back? No way. In my opinion the Example Window now looks good and works well. Thank you for you efforts! A few minor tweaks can be added, like the ones in your patch above. 
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 09, 2022, 12:53:41 am
OK, https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40036
Sorry this project has needed so much attention, despite my enthusasim to tackel it, evidence is it was beyond me. Still, I think its OK now but will not, in any way be offended if its decided to drop it.
Like Juha asked 'me', why are 'you' apologizing? How is it beyond you when it is already working? Maybe not 100% the way everyone would like to see it work but we are getting there. So please no more talk of this 'people deciding to drop it', and it would be best if you[da] gets back to work on that as and when time permits him to do so. I fail to understand how does a person who chops his own firefood just give up? So uh-uh not happening on my shift  :)

Reverting back to old Example Window in the IDE would be easy, a global find and remove of *.ex-meta files easy too.
No need to revert. I am working on the old 'testall' and we can always put it in LCL/tests as Juha suggested. So we have access to the old 'testall' as well as the 'examples' you are working on. Problem solved and we have the best of both worlds? Now this next question is related to the old 'testall' and if everyone wants a separate thread that would be fine but I am asking here in the mean time.

I ran git blame examples/testall.lpi and below is what is of interest to us.
Code: Text  [Select][+][-]
  1. 87791326d0d (bart     2016-03-04 15:05:52 +0000  87)     <SearchPaths>
  2. 87791326d0d (bart     2016-03-04 15:05:52 +0000  88)       <IncludeFiles Value="$(ProjOutDir)"/>
  3. 5328b9a852b (juha     2019-05-06 11:32:58 +0000  89)       <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
  4. 87791326d0d (bart     2016-03-04 15:05:52 +0000  90)     </SearchPaths>
  5.  

In 2019 Juha added  <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> this works for windows but does not work for Linux
as seen by the error message below.

Code: Text  [Select][+][-]
  1. Unable to write state file for project Project
  2. Error: Unable to create file "/home/aruna/lazarus/examples/lib\x86_64-linux/testall.compiled": No such file or directory
  3.  
The path is all that needs to be fixed so I changed the '\' backslash after /home/aruna/lazarus/examples/lib\ to a forward slash and now it works on linux. My question to you all is the testall.lpi file contents are in XML format so how do I do something like {$ifdef linux} in a XML file for christ sake  ::) OR as is usual in my case I am missing something  obvious?

By the way David you have the same name of a young boy in a biblical tale that had a slingshot and a rock and proceeded to slay the giant Goliath, I am just saying...  :P Go slay them bugs mate! (I am officially done sulking)






Title: Re: Bugs in Example Projects window
Post by: dbannon on December 09, 2022, 04:51:08 am
There is more going on there than meets the eye Aruna, the lpi file is written to by Lazarus, not you and I. So, please check the paths in the Lazarus project, click Project->ProjectOptions->Paths perhaps ?

Maybe it has a specific hard wired (for Windows) path in there, the rest of the path you found is pure linux, no windows machine is going to have a path like that. Strange.

Generally, in your code, you would use the const "PATHDELIM" , never use either slash unless you are absolutely certain is not cross platforms (except, of course in a web address ....).
-----

My concern about the future of the new Example Window is the growth in complexity, too complex means too hard to maintain ! And thats a bad thing !

davo

Davo

Davo
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 09, 2022, 05:54:58 am
I will return to this issue soon. Now going to work with carrots...

[Edit] For this winter I am a carrot professional. It is good physical work. I move literally tons of carrots around. There is also brain activity involved when classifying carrots as 1., 2. or 3. quality. On a conveyor belt there is 0.x seconds / carrot to make the decision and there are lots of border cases. Hands must move quickly to separate them.
With computer programming I can ponder on problems much longer. :)

In the evenings I feel lazy.
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 10, 2022, 07:32:25 pm
Most likely the KeyPreview property of the form is false.
Damn yes. Somehow I forgot it. The latest commit fixes it and cleans the VK_ESCAPE handling.

Sorry this project has needed so much attention, despite my enthusasim to tackel it, evidence is it was beyond me. Still, I think its OK now but will not, in any way be offended if its decided to drop it.
Nobody wants to drop it!
The evidence shows otherwise. People study it and suggest improvements. That is how FOSS development works. Somebody must do a first version of anything before others get interested.
Sometimes the views differ and there may be heated discussion. That is fine as long as the arguments are based on technical issues.
The other alternative would be that nobody cared about your example window work. Everybody just ignored it. That wouldn't be nice.

Although I have commit rights, I am not a high authority deciding about your example window. My suggestion about the FilterEdit went wrong. ListViewFilterEdit is poorly documented but also it is designed quickly to work only with the simple use cases where it is used now.
I even forgot the KeyPreview property which is a newbie error.

My concern about the future of the new Example Window is the growth in complexity, too complex means too hard to maintain ! And thats a bad thing !
I don't see it as too complex or too hard to maintain. The search engine is quite advanced.
The Lazarus project contains much more complex code. Please study the Codetools and its integration with source editor as an example.
Maybe you later find ways to clarify your code and make it shorter. I didn't study it well enough to know.

@Aruna, I will create a new thread about TestAll project issues.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 11, 2022, 04:37:32 am
@Aruna, I will create a new thread about TestAll project issues.
Ok sounds good to me.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 11, 2022, 05:18:46 am
[Edit] For this winter I am a carrot professional. It is good physical work. I move literally tons of carrots around. There is also brain activity involved when classifying carrots as 1., 2. or 3. quality. On a conveyor belt there is 0.x seconds / carrot to make the decision and there are lots of border cases. Hands must move quickly to separate them.
I have many worked many factories here in Toronto over the last 16 years and on many conveyor belts before moving onto an office environment call center and now I am involved with homeless people and hiv/aids agencies in downtown Toronto. Those conveyor belts I never used to like they usually crank up the speed to get extra production failing to understand we are not machines we have to deal with fatigue and hunger. And a 8 hour shift usually left me dog tired and you have to be very careful on the belt otherwise quite possible you can injure your hands or fingers. But yes this kind of work will keep you healthy  :D

With computer programming I can ponder on problems much longer. :)
Yes especially the problems 'I' create like changing the path from '/' to '\' manually to trigger that error :-D

In the evenings I feel lazy.
A ice cold beer and some hot food usually helps..
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 11, 2022, 06:10:43 am
There is more going on there than meets the eye Aruna, the lpi file is written to by Lazarus, not you and I. So, please check the paths in the Lazarus project, click Project->ProjectOptions->Paths perhaps ?
I knew it... and Juha just re-confirmed what you said it seems the ide at some point converts the path delimiter as needed by the operating system things are running on eh

Maybe it has a specific hard wired (for Windows) path in there, the rest of the path you found is pure linux, no windows machine is going to have a path like that. Strange.
Actually 'I' manually changed the '\' to a '/` to get things working an reverted things again to trigger the error. It seems I had checked out a branch before Juha's fix, it happens!

Generally, in your code, you would use the const "PATHDELIM" , never use either slash unless you are absolutely certain is not cross platforms (except, of course in a web address ....).
Thank you I will grep for this "PATHDELIM"

My concern about the future of the new Example Window is the growth in complexity, too complex means too hard to maintain! And thats a bad thing !
We can cross that bridge when we get to it, you worry too much. Remember, use the mouse Luke :-D
Title: Re: Bugs in Example Projects window
Post by: balazsszekely on December 11, 2022, 11:46:03 am
More suggestions:

1. Since there are 200+ example projects, it's very likely that users will perform a search first. In my opinion EditSearch should receive focus, this also follows IDE convention.
However if it's decided that ListView is the active control, which is also fine, at least can we select the first item? Also ListView.RowSelect looks much better in my opinion.
2. TabOrder is not correct
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 11, 2022, 10:06:45 pm
1. Since there are 200+ example projects, it's very likely that users will perform a search first. In my opinion EditSearch should receive focus, this also follows IDE convention.
However if it's decided that ListView is the active control, which is also fine, at least can we select the first item? Also ListView.RowSelect looks much better in my opinion.
2. TabOrder is not correct
I fixed the TabOrder in my latest commit. At least with GTK2 the focus visually shows only in the SearchEdit filter control when pressing TAB many times. So it made very little difference.
My commit also adds a SpeedButton to clear the SearchEdit filter. Please test.

Number 1. suggestion also sounds good but I will leave it for dbannon.

I wanted to add a glyph image to the SpeedButton. The image ('btnfiltercancel') is already part of LCL and is used in the IDE's controls. Yet calling :
Code: Pascal  [Select][+][-]
  1. ClearSearchButton.LoadGlyphFromLazarusResource('btnfiltercancel');
does not work. Resource 'btnfiltercancel' not found.
IIRC that function works for SpeedButtons in the IDE. This example window is an IDE plugin and LoadGlyphFromLazarusResource should work there as well.
Now I loaded the bitmap directly into the button's Glyph property. Loading from LCL would share resources and support High-DPI automatically.
Any ideas?
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 12, 2022, 12:15:06 am
......it's very likely that users will perform a search first. In my opinion EditSearch should receive focus, .....
Indeed this was my first model, however, GTK2 does not show the TextHint if the control has focus. And by default, Lazarus on Linux is based on GTK2. We could avoid this problem (and a lot of code I suspect) if we just added a label next to the EditSearch "Search Here" but, honestly, that does not look cool.

As it is now, the user is blissfully unaware of which control has focus, if they start typing character, they appear in the editsearch box and if they use the cursor keys, focus moves up and down in the ListView. (First part being Getmem's excellent suggestion). If the user presses Enter while in EditSearch (natural thing to do after entering text), focus is again shifted back to ListView so, again, thats what a user probably, unconsciously, expects. They don't need to tab right around (but can if they want to).

I note Juha has altered the Tab order from what I initially set, I had the EditSearch first tabstop after (opening) ListView, now its last on the list. Juha's model is good if the user realizes that typing will automatically take you to the EditSearch but that is not obvious IMHO. So I provided one (tab) press to get there. Now, once you press Tab, you have to keep pressing (or use the mouse). I am uncertain ....

We have also set a goal that the window is usable without a mouse (necessary or otherwise) so that means everything needs to be a tabstop. Personally, I rarely tab between controls and don't believe too many other users do either. But its there.

Juha, the speedbutton to clear ?  Seems to work as expected to me. Is your question about conserving resources rather than function ?

Davo

PS : Juha, the carrots are great, people need to eat. But what about your forestry project, that is far more interesting ??
Title: Re: Bugs in Example Projects window
Post by: balazsszekely on December 12, 2022, 07:20:48 am
I wanted to add a glyph image to the SpeedButton. The image ('btnfiltercancel') is already part of LCL and is used in the IDE's controls. Yet calling :
Code: Pascal  [Select][+][-]
  1. ClearSearchButton.LoadGlyphFromLazarusResource('btnfiltercancel');
does not work. Resource 'btnfiltercancel' not found.
IIRC that function works for SpeedButtons in the IDE. This example window is an IDE plugin and LoadGlyphFromLazarusResource should work there as well.
Now I loaded the bitmap directly into the button's Glyph property. Loading from LCL would share resources and support High-DPI automatically.
Any ideas?

This works for me:
Code: Pascal  [Select][+][-]
  1. ClearSearchButton.LoadGlyphFromResourceName(HInstance, 'btnfiltercancel');


Indeed this was my first model, however, GTK2 does not show the TextHint if the control has focus. And by default, Lazarus on Linux is based on GTK2.
Even without the TextHint it's pretty obvious that the first control is a filter, especially after @Juha added the filter glyph, but I don't want to insist, it's up to you to decide.  I'll shut up now.  :)
Title: Re: Bugs in Example Projects window
Post by: wp on December 12, 2022, 01:45:16 pm
I wanted to add a glyph image to the SpeedButton. The image ('btnfiltercancel') is already part of LCL and is used in the IDE's controls. Yet calling :
Code: Pascal  [Select][+][-]
  1. ClearSearchButton.LoadGlyphFromLazarusResource('btnfiltercancel');
does not work. Resource 'btnfiltercancel' not found.
IIRC that function works for SpeedButtons in the IDE. This example window is an IDE plugin and LoadGlyphFromLazarusResource should work there as well.
Now I loaded the bitmap directly into the button's Glyph property. Loading from LCL would share resources and support High-DPI automatically.
Any ideas?
AFAIK, the image is not in a Lazarus resource but in an FPC resource (res), and this is why the image is not found. But after Ondrej's rework of the speedbutton and bitbtn glyphs it is much more advantageous to use an imagelist to assign the glyphs because this automatically handles lcl scaling. And in unit ideimagesintf, there's a ready-to-use imagelist with the available resource images: IDEImages.Images_16, and the imageindex can be found from the GetImageIndex method with the resource name as parameter:
Code: Pascal  [Select][+][-]
  1.     ClearSearchButton.Images := IDEImages.Images_16;
  2.     ClearSearchButton.ImageIndex := IDEImages.GetImageIndex('btnfiltercancel');
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 12, 2022, 05:44:33 pm
... GTK2 does not show the TextHint if the control has focus.
That is perfectly OK. There are similar filter edits around the IDE with identical SpeedButton icons for clearing them. Clever Lazarus users know immediately what it is.
Other FilterEdits around the IDE get focus initially. It is a convention.

Quote
As it is now, the user is blissfully unaware of which control has focus, if they start typing character, they appear in the editsearch box and if they use the cursor keys, focus moves up and down in the ListView. (First part being Getmem's excellent suggestion). If the user presses Enter while in EditSearch (natural thing to do after entering text), focus is again shifted back to ListView so, again, thats what a user probably, unconsciously, expects. They don't need to tab right around (but can if they want to).

I note Juha has altered the Tab order from what I initially set, I had the EditSearch first tabstop after (opening) ListView, now its last on the list. Juha's model is good if the user realizes that typing will automatically take you to the EditSearch but that is not obvious IMHO. So I provided one (tab) press to get there. Now, once you press Tab, you have to keep pressing (or use the mouse). I am uncertain ....
TabOrder must be from top-down, left-right. That is a GUI convention everywhere. TAB must not jump around here and there.
At least with LCL-GTK2 for some reason only the edit control shows visually it has focus. The ListView or Memo do not. It is confusing.

Quote
We have also set a goal that the window is usable without a mouse (necessary or otherwise) so that means everything needs to be a tabstop. Personally, I rarely tab between controls and don't believe too many other users do either. But its there.
Support for using keyboard to navigate a GUI is a normal convention again. Nothing special to this Examples window.

Thanks for GetMem for testing the SpeedButton icon issue and for wp for solving it properly. I try to remember the right way to do it. I confess I didn't search for the solution long enough.

P.S.
Quote
But what about your forestry project, that is far more interesting ??
My hobby forest now sleeps under thick snow. South Finland got permanent snow in mid-November which is unusual. Now we have a proper winter, cold and lots of snow, and more is coming! May be a record snow level before mid-December. A new ice age is coming clearly.
No complaints though. Santa Claus can use his sledge this year without problems. Everything is clean and white. No slush, no slippery pavements due to melting-freezing-melting-freezing cycle like often here.
I sold the trees I thinned last spring and summer as 3 meter long logs to be used as firewood. In the autumn I fell rest of the trees to be thinned. They now lay on the ground criss-cross on top of each other with branches still attached, thus mostly not touching ground. The project will continue next spring. The best time for forest work is April when most snow but not all has melted. Air is humid, temperature +5°C, sun shines, birds sing, no insects yet. Perfect!
Firewood business could be expanded. The forest has pine, birch, aspen and other sorts in addition to fir trees. I only must get some winch system to pull them out of the forest. So far I have pulled them myself using log scissors. Traditionally horsed have done the pulling. I understand why, logs are heavy.
I dare to link a picture of my son who visited and helped with the logs, although this is out of topic in Lazarus list :
 https://drive.google.com/file/d/1hS_f_1zMAYLz03n2gie5rmJ1Ko0wdCMQ/view
He worked with a chainsaw for the first time and liked it.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 13, 2022, 12:37:57 pm
Hello everyone, I tried to test the latest changes in ulaz_examples.lpi but got this warning below.
Code: Text  [Select][+][-]
  1. The project does not use the LCL unit interfaces, which is required by LCLBase.
  2. You will get strange linker errors if you use the LCL without interfaces.

I have attached a screenshot. What am I doing wrong? The output from my terminal is below.

Code: Bash  [Select][+][-]
  1. aruna@debian:~/lazarus$ ./lazarus
  2. Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] PrimaryConfigPath="/home/aruna/.lazarus"
  3. Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] SecondaryConfigPath="/etc/lazarus"
  4. Hint: (lazarus) [TMainIDE.DoOpenProjectFile] "/home/aruna/lazarus/components/exampleswindow/ulaz_examples.lpi"
  5. Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=x86_64-linux-gtk2 New=x86_64-linux-gtk2 Changed: OS/CPU=True LCL=False
  6. InitOpenedProjectFile select form in designer: FormLazExam:TFormLazExam TDesigner
  7. ----------------
  8. Hint: (lazarus) [TMainIDE.DoRunProject] INIT
  9. Info: (lazarus) [SaveProject] CheckMainSrcLCLInterfaces failed
  10. Error: (lazarus) [TMainIDE.DoBuildProject] DoSaveForBuild failed
  11. Info: (lazarus) [TMainIDE.DoInitProjectRun] DoBuildProject failed
  12.  

Another thing I noticed quite by accident is when I close the IDE using File->Quit everything shuts down and I am back in my terminal. Which is good. If I use the close 'X' in the top right corner of the window in the IDE then it does close everything but I am not taken back to a shell prompt. I am taken back to the terminal but it hangs until I press Ctrl+C ? This is nothing urgent or a major issue just thought I should let you know.

I have been asked to work Mon to Fri again so I may not be as active as I am right now but on weekends I will try to be around.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 13, 2022, 01:31:44 pm
Hello everyone, I tried to test the latest changes in ulaz_examples.lpi but got this warning below.
Code: Text  [Select][+][-]
  1. The project does not use the LCL unit interfaces, which is required by LCLBase.
  2. You will get strange linker errors if you use the LCL without interfaces.

Aruna, I am not sure just what you are doing "I tried to test the latest changes ulaz_examples.lpi". To test the example window, get Lazarus Main, build it and run it. Click the Examples button or menu under tools.  You should not be interacting with ulaz_examples.lpi directly.

Another thing I noticed quite by accident is when I close the IDE using File->Quit everything shuts down and I am back in my terminal. Which is good. If I use the close 'X' in the top right corner of the window in the IDE then it does close everything but I am not taken back to a shell prompt. I am taken back to the terminal but it hangs until I press Ctrl+C ? This is nothing urgent or a major issue just thought I should let you know.
Does it have to be Ctrl-C ?  Maybe just Enter ? In both cases, you are back in the terminal with a shell prompt its just if there is some data there, the terminal does not always show the prompt until it sees some input from you. All good.


I have been asked to work Mon to Fri again so I may not be as active as I am right now but on weekends I will try to be around.

Good for you !

Davo
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 13, 2022, 07:57:10 pm
Aruna, I am not sure just what you are doing "I tried to test the latest changes ulaz_examples.lpi". To test the example window, get Lazarus Main, build it and run it. Click the Examples button or menu under tools.  You should not be interacting with ulaz_examples.lpi directly.
Indeed the ulaz_examples.lpi project does not work. I guess it is a standalone version of the examples window. IMO it should be either fixed or removed.
@Aruna, exampleprojects.lpk is the IDE plugin package.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 14, 2022, 01:38:08 am
I have no idea ulaz_examples.lpi is doing there. Running ulaz_examples as a standalone project makes no sense, it needs a wrapper around it to provide various data inputs. I don't remember making it but I must have, perhaps in early experimental days.

I have tested both my Test Rig for ulaz_examples and Lazarus itself, neither care that ulaz_examples.lpi was deleted. Its a distraction, remove it please !

If you want to run ulaz_examples in a standalone mode (heaps easier to test/develop) I suggest https://gitlab.com/dbannon/laz_examples/-/tree/main/Utility/ExScanner - the temp rig I made to manage moving the various examples around and building their initial metadata files. Most of its functionality is now redundant and its a bit of a lash up. But its one remaining use is to test the new Examples window outside of Lazarus.

Maybe I should strip out all the redundant stuff and make it just the wrapper to demonstrate the Example Window ?

As mentioned previously, to just create and edit a metadata file use   https://github.com/davidbannon/ExampleMetaData

Davo
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 14, 2022, 04:01:30 am
I dare to link a picture of my son who visited and helped with the logs, although this is out of topic in Lazarus list :
 https://drive.google.com/file/d/1hS_f_1zMAYLz03n2gie5rmJ1Ko0wdCMQ/view
He worked with a chainsaw for the first time and liked it.
If that young man was to grow a beard he would be your twin. He looks exactly like you.
I have never used a chainsaw. Maybe one day :-) And I see your shadow on the ground in the picture.
That is a lot of logs.What kind of car is that? Must be very strong if it can pull all those logs.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 14, 2022, 04:06:19 am
Aruna, I am not sure just what you are doing "I tried to test the latest changes ulaz_examples.lpi". To test the example window, get Lazarus Main, build it and run it. Click the Examples button or menu under tools.  You should not be interacting with ulaz_examples.lpi directly.
I wanted to test the examples window just like any other stand-alone if I can do that it will save me a lot of time compared to always git fetch then git merge then rebuild the ide (which can be a real pain when you have to do it many times). So how do I get it to run like any other stand alone then?

Title: Re: Bugs in Example Projects window
Post by: Aruna on December 14, 2022, 04:07:49 am
Aruna, I am not sure just what you are doing "I tried to test the latest changes ulaz_examples.lpi". To test the example window, get Lazarus Main, build it and run it. Click the Examples button or menu under tools.  You should not be interacting with ulaz_examples.lpi directly.
Indeed the ulaz_examples.lpi project does not work. I guess it is a standalone version of the examples window. IMO it should be either fixed or removed.
@Aruna, exampleprojects.lpk is the IDE plugin package.
Yes Juha I saw both the .lpk and the .lpi so I decided to give the .lpi a test drive but as you saw the IDE started complaining.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 14, 2022, 04:19:27 am
I have no idea ulaz_examples.lpi is doing there. Running ulaz_examples as a standalone project makes no sense, it needs a wrapper around it to provide various data inputs. I don't remember making it but I must have, perhaps in early experimental days.
Well no one remembers everything they did especially if it has been many months so this is normal. I can't remember what I did last evening most times.

I have tested both my Test Rig for ulaz_examples and Lazarus itself, neither care that ulaz_examples.lpi was deleted. Its a distraction, remove it please !
I disgaree. You say distraction I say this is an opportunity to learn? And once we learn how to get that ulaz_examples.lpi to run like a stand alone it will help others at some later point in time. If you look carefully the form caption/title says 'Prototype'

If you want to run ulaz_examples in a standalone mode (heaps easier to test/develop) I suggest https://gitlab.com/dbannon/laz_examples/-/tree/main/Utility/ExScanner - the temp rig I made to manage moving the various examples around and building their initial metadata files. Most of its functionality is now redundant and its a bit of a lash up. But its one remaining use is to test the new Examples window outside of Lazarus.
This is exactly what I want to do but why can I not do this in teh Lazarus ide? Why do I have to do this outside of lazarus? That would be defeating the purpose?

Maybe I should strip out all the redundant stuff and make it just the wrapper to demonstrate the Example Window ?
Yes please lets do that.

As mentioned previously, to just create and edit a metadata file use   https://github.com/davidbannon/ExampleMetaData
I am still trying to understand the reason you decided to go with json? We can do the same thing with a simple text file? Unless you were thinking of the online/internet/trunk/remote stuff? With a plain old text file we can reduce the code to a few lines compared to what we need right now to process that json?

Title: Re: Bugs in Example Projects window
Post by: dbannon on December 14, 2022, 05:29:25 am

If you want to run ulaz_examples in a standalone mode (heaps easier to test/develop) I suggest https://gitlab.com/dbannon/laz_examples/-/tree/main/Utility/ExScanner - the temp rig I made to manage moving the various examples around and building their initial metadata files. Most of its functionality is now redundant and its a bit of a lash up. But its one remaining use is to test the new Examples window outside of Lazarus.
This is exactly what I want to do but why can I not do this in teh Lazarus ide? Why do I have to do this outside of lazarus? That would be defeating the purpose?

If you want to use the Example Window as part of the IDE, click the appropriate Button or menu item.

If you want to play with its code, see the project I mentioned above.

The only other combination I can see if opening the Example Window as a project without downloading  https://gitlab.com/dbannon/laz_examples/-/tree/main/Utility/ExScanner. If thats necessary, as I said, I can strip out the unneeded content from ExScanner and put it in the lazarus source tree. I don't know what the policy is wrt unnecessary code like that. Personally, I think its a reasonable idea but will wait for Juha to comment.

But whatever happens, the existing ulaz_examples.lpi has no place in the source tree.

I am still trying to understand the reason you decided to go with json? We can do the same thing with a simple text file? Unless you were thinking of the online/internet/trunk/remote stuff? With a plain old text file we can reduce the code to a few lines compared to what we need right now to process that json?
In the early part of this project, we considered moving the Examples to an online repo, that would reduce the SRC tree size a bit and it was one way to solve the *nix "installed in Read Only Space" issue. However, Lazarus on MacOS has a less than perfect http unit and it was decided to drop that for the immediate future at least. The code is still in there, ifdef'ed out and the repo where the content lives is   https://gitlab.com/dbannon/laz_examples/ - now only used when a user asks to see an example in the browser.

The tools to manage keeping that repo up to date are in the current EXScanner ....

Davo
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 15, 2022, 03:34:06 pm
I removed the obsolete .lpi file in 8a80bb3b85.

If you want to run ulaz_examples in a standalone mode (heaps easier to test/develop) I suggest https://gitlab.com/dbannon/laz_examples/-/tree/main/Utility/ExScanner - the temp rig I made to manage moving the various examples around and building their initial metadata files. Most of its functionality is now redundant and its a bit of a lash up. But its one remaining use is to test the new Examples window outside of Lazarus.
This is exactly what I want to do but why can I not do this in teh Lazarus ide? Why do I have to do this outside of lazarus? That would be defeating the purpose?
You can open the ExScanner project in Lazarus IDE after you downloaded it from gitlab.com/dbannon repository. It should be easy enough.
Lazarus distribution should stay slim and not be bloated with such extra stuff. I also hope the online examples idea is still alive. It would be a perfect match.
The Examples window is able to open a selected example project in the IDE on the fly. That's why it is an IDE plugin. A standalone application cannot do that.

I wanted to test the examples window just like any other stand-alone if I can do that it will save me a lot of time compared to always git fetch then git merge then rebuild the ide (which can be a real pain when you have to do it many times). So how do I get it to run like any other stand alone then?
You are doing something wrong if the update is a pain. Just do "git pull" in main branch, then open Lazarus IDE and rebuild it from its Tools menu. Usually the build is quick. However after a (rare) refactoring change that moved files around the compilation may fail and you must select "Clean all" in the Configure "Build Lazarus" window. Then compilation takes longer but even then just few minutes unless you have a very slow machine.

P.S.
What kind of car is that? Must be very strong if it can pull all those logs.
Volvo S60 AWD from 2002, bought from a net auction almost 4 years ago. A 5-cylinder engine with turbo. Yes, 5 (five).
The German Anssems trailer has brakes and can carry over a ton of payload legally. Nice!
I guess you saw my Google profile photo which is outdated. Now I look older because ... I am older. I will remove the profile photo sometime soon.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 16, 2022, 03:50:13 am
I am still trying to understand the reason you decided to go with json? We can do the same thing with a simple text file? Unless you were thinking of the online/internet/trunk/remote stuff? With a plain old text file we can reduce the code to a few lines compared to what we need right now to process that json?
In the early part of this project, we considered moving the Examples to an online repo, that would reduce the SRC tree size a bit and it was one way to solve the *nix "installed in Read Only Space" issue. However, Lazarus on MacOS has a less than perfect http unit and it was decided to drop that for the immediate future at least. The code is still in there, ifdef'ed out and the repo where the content lives is   https://gitlab.com/dbannon/laz_examples/ - now only used when a user asks to see an example in the browser.
Ok now I understand. Thank you.


The tools to manage keeping that repo up to date are in the current EXScanner ....
Thanks I will stop by that repo soon :-)
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 16, 2022, 04:06:13 am
You can open the ExScanner project in Lazarus IDE after you downloaded it from gitlab.com/dbannon repository. It should be easy enough.
Thank you I will try this soon.

Lazarus distribution should stay slim and not be bloated with such extra stuff. I also hope the online examples idea is still alive. It would be a perfect match.
The Examples window is able to open a selected example project in the IDE on the fly. That's why it is an IDE plugin. A standalone application cannot do that.
Agreed no bloat and slim as we can get is good. What exactly is this  online examples you are referring to? This is the first time I am hearing of this. I think David mentioned this as well but I was not aware we had a repositery full of online examples somewhere. Or is this yet to be done?

You are doing something wrong if the update is a pain. Just do "git pull" in main branch, then open Lazarus IDE and rebuild it from its Tools menu. Usually the build is quick. However after a (rare) refactoring change that moved files around the compilation may fail and you must select "Clean all" in the Configure "Build Lazarus" window. Then compilation takes longer but even then just few minutes unless you have a very slow machine.
The last three lines below in the bash terminal output snippet should answer the question if my machine is slow. And this was a make clean all from the command prompt. I like to see all the stuff the shell/terminal throws up as it goes through the copile and link proces :-D Line # 17,18 and 19 will be of interest.
Code: Bash  [Select][+][-]
  1. -Hint: (11030) Start of reading config file /etc/fpc.cfg
  2. Hint: (11031) End of reading config file /etc/fpc.cfg
  3. Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64
  4. Copyright (c) 1993-2020 by Florian Klaempfl and others
  5. (1002) Target OS: Linux for x86-64
  6. (3104) Compiling startlazarus.lpr
  7. (3104) Compiling redirect_stderr.pas
  8. (3104) Compiling lazarusmanager.pas
  9. /home/aruna/lazarus/ide/lazarusmanager.pas(138,35) Hint: (5024) Parameter "Sender" not used
  10. (9022) Compiling resource ../units/x86_64-linux/gtk2/startlazarus.or
  11. (9015) Linking ../startlazarus
  12. (1008) 748 lines compiled, 2.7 sec
  13. (1022) 3 hint(s) issued
  14. make[2]: Leaving directory '/home/aruna/lazarus/ide'
  15. make[1]: Leaving directory '/home/aruna/lazarus/ide'
  16.  
  17. real    2m12.537s
  18. user    1m35.501s
  19. sys     0m7.744s
  20. aruna@debian:~/lazarus$
  21.  

P.S.
What kind of car is that? Must be very strong if it can pull all those logs.
Volvo S60 AWD from 2002, bought from a net auction almost 4 years ago. A 5-cylinder engine with turbo. Yes, 5 (five).
The German Anssems trailer has brakes and can carry over a ton of payload legally. Nice!
I guess you saw my Google profile photo which is outdated. Now I look older because ... I am older. I will remove the profile photo sometime soon.
Wow a 5 cylinder eh? Volvo's are very strong cars built to last. I saw your picture here (https://wiki.freepascal.org/Developer_pages):
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 16, 2022, 03:24:11 pm
Agreed no bloat and slim as we can get is good. What exactly is this  online examples you are referring to? This is the first time I am hearing of this. I think David mentioned this as well but I was not aware we had a repositery full of online examples somewhere. Or is this yet to be done?
It is yet to be done, although the Examples window has already code for it. There were some technical issues.
It would be analogous to the online package manager. Practically every programmer nowadays has an internet connection. It wasn't so always. Even with a poor connection it is enough to get a proper connection once to download many online examples and packages which then stay in the user's machine. It is the right way to go with code that only part of the users need.

Quote
The last three lines below in the bash terminal output snippet should answer the question if my machine is slow. And this was a make clean all from the command prompt. I like to see all the stuff the shell/terminal throws up as it goes through the copile and link proces :-D Line # 17,18 and 19 will be of interest.
Code: Bash  [Select][+][-]
  1. real    2m12.537s
  2. user    1m35.501s
  3. sys     0m7.744s
Nice. Not slow.
Did you know that rebuilding Lazarus from its Tool menu is even faster because it compiles packages in parallel? The more CPU cores you have, the faster it compiles.
This is true both for your own projects and for a Lazarus rebuild.

Quote
Wow a 5 cylinder eh? Volvo's are very strong cars built to last. I saw your picture here (https://wiki.freepascal.org/Developer_pages):
OK, my picture in wiki developer pages is also outdated. I guess I should take a new picture of myself.
Volvo's 5-cylinder engines have a unique sound, also partly because of its crankshaft angles and exhaust manifold design. Somebody wrote it sounds like a baby-10-cylinder engine.
 https://www.youtube.com/watch?v=5FQh79xgaK0
More Volvo exhaust fumes: https://www.youtube.com/watch?v=DybVpNuPKFU  Swedish commentator  :)

One more out of topic picture, taken today :
 https://drive.google.com/file/d/1-2-42qMzRCKdcVJEPjAMPQCJdvFMtmFq/view
We have almost 40 cm of snow. There was never so much snow in southern Finland in mid-December during my lifetime. Ice age coming!
Temperature early this morning was -23°C.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 18, 2022, 12:26:28 am
I removed the obsolete .lpi file in 8a80bb3b85.
Thanks !

You can open the ExScanner project in Lazarus IDE after you downloaded it from gitlab.com/dbannon repository. It should be easy enough.
Lazarus distribution should stay slim and not be bloated with such extra stuff. I also hope the online examples idea is still alive. It would be a perfect match.
But remember, to do a valid test using EXScanner, you must copy the current ulaz_examples.pas/lfm files from the Lazarus tree into ExScanners tree so its testing the current version !  (And possibly some of the other files from ~/components/examplewindow if they have changed. Use diff if doubtfull.

I will strip ExScanner down to just a demo of uLaz_examples, remove or maybe hide some of the other stuff. As time permits. Had a couple of days in hospital so running behind with stuff at the moment.

The online code is still there and, I hope reasonably easily resurrected. At the time, MacOS's fphttp systems were not functional (according to Trev) and it needed a whole lot of Mac specific code using the Mac API, think it related to ssl but would need to go back and check.  I considered it impractical to add all that Mac specific code then ....

But I do like the idea still. The on line repo itself is there and I keep it current because its an easy way to view the example code (in a browser) with out closing the project you are working on.

I wanted to test the examples window just like any other stand-alone if I can do that it will save me a lot of time compared to always git fetch then git merge then rebuild the ide (which can be a real pain when you have to do it many times). So how do I get it to run like any other stand alone then?

No, no need to git fetch. Just pull. If you have made a lot of local changes, easy to revert them with git checkout <file> unless you want to keep them.  Un like Juha, I always do a make clean before make. Just to be sure.  You don't need to do that pull that often, look on gitlab and see if any changes have been made in the specific area you are working in, if not, don't be in too much of a rush to pull.

Quote
Volvo S60 AWD from 2002, bought from a net auction almost 4 years ago. A 5-cylinder engine with turbo. Yes, 5 (five).
Diesel ? My Ranger has a European 5 cyclinder Diesel, they could have some common ansersory. Its a great engine, strong and reliable.

Juha, those logs ? They look straight and long enough for construction use, seems a waste to use them for firewood, is there no better market than that ?  We don't use softwood for firewood here anyway, having a good (but NOT endless) supply of hardwood.  Hmm, being softwood, they would be lighter than I would expect just looking at the picture.

That 'snowy' picture you linked to Juha, looks very Christmassy !  here in AU, where its hot over Christmas, we still send people christmas cards with pictures like that !

Quote from: Aruna
I was not aware we had a repositery full of online examples somewhere. Or is this yet to be done?
Open the Examples Window, select a project and click "View in Browser".

Davo
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 18, 2022, 05:24:23 pm
Still about the ListViewFilterEdit control :
* How to add an item ?  Seems its a call to ~.items.add(Item:T); And that item is fgl thingo. I use Pascal because its strongly typed, if I want something that can be any old type depending on the day of the week, I'd use Python.
A specialized generics type is strongly typed. In this case it is a container of TListViewDataItem.
Code: Pascal  [Select][+][-]
  1. TListViewDataList = specialize TFPGList<TListViewDataItem>;
The bug is in Codetools. The code hint in editor shows "const Item T" instead of "const Item TListViewDataItem". It doesn't mean that compiler would accept any other type than TListViewDataItem.
I found it was reported already 6 years ago.
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/29860
Somebody should fix it. The report even gives a hint about where the fix should go.

The ListViewFilterEdit example project you provided revealed a bug in the filter. Setting Filter := 'x' in program code does not show it visually in the edit. I will fix and extend it.

Diesel ? My Ranger has a European 5 cyclinder Diesel, they could have some common ansersory. Its a great engine, strong and reliable.
My Volvo has a 2.4 liter gasoline engine. Yes, Ford co-operated with Volvo at some point. The engine has Volvo origins.

Quote
Juha, those logs ? They look straight and long enough for construction use, seems a waste to use them for firewood, is there no better market than that ?  We don't use softwood for firewood here anyway, having a good (but NOT endless) supply of hardwood.  Hmm, being softwood, they would be lighter than I would expect just looking at the picture.
Complex issue. Big wood companies prefer to buy a lot of wood at a time. By selling firewood I could do it gradually. I am a newbie in selling wood, let's see what happens.
We have little "hardwood" here. Birch is the best firewood energy-wise, but fir and pine are burned as we have a lot of them.
The logs in the pic were not very heavy because they had dried a bit during a hot summer. Later I fell and lifted some fresh wood logs that were heavy. Both the trailer and myself were at our limits carrying them.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 19, 2022, 12:43:23 am
....
The bug is in Codetools. The code hint in editor shows "const Item T" instead of "const Item TListViewDataItem". It doesn't mean that compiler would accept any other type than TListViewDataItem.
I found it was reported already 6 years ago.
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/29860
Somebody should fix it. The report even gives a hint about where the fix should go.
OK, that makes more sense. My favorite thing with Pascal is its strong Typing, that bug seemed (but only "seemed") to confirm my worst fears !  Very glad its just a codetools issue. I depend on CodeTools quite a lot, if its wrong, there was nowhere to fall back on. But, as you see in the demo, it was pretty easy to work out.

The ListViewFilterEdit example project you provided revealed a bug in the filter. Setting Filter := 'x' in program code does not show it visually in the edit. I will fix and extend it.
That would be much nicer. The programmer can, of course, set it themself. Do you have the time to fix it ?

We have little "hardwood" here. Birch is the best firewood energy-wise, but fir and pine are burned as we have a lot of them.
And of course they grow a lot quicker than hardwood too. My own land, classed as "woodland", not forest, is all hardwood mostly about 100 years old. Was all cleared back in the gold rush. Australia grows a lot of pinus radiata, not a native but good commercial crop. Grows fast if it gets enough water. But our fire places and wood burners are designed for hardwood.

But, yes, it makes sense to sell firewood by the trailer load but it would be much nicer if you could get in touch with a local builder who wanted it.  8)

Davo
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 19, 2022, 11:55:32 pm
Agreed no bloat and slim as we can get is good. What exactly is this  online examples you are referring to? This is the first time I am hearing of this. I think David mentioned this as well but I was not aware we had a repositery full of online examples somewhere. Or is this yet to be done?
It is yet to be done, although the Examples window has already code for it. There were some technical issues.
It would be analogous to the online package manager. Practically every programmer nowadays has an internet connection. It wasn't so always. Even with a poor connection it is enough to get a proper connection once to download many online examples and packages which then stay in the user's machine. It is the right way to go with code that only part of the users need.
Yes I remember those days when all we had was a dial up connection using a modem running at 9600 baud, 9.6kb/sec somewhere in the early 1980's and later at 56,000 baud, 56kb/sec  over a two-wire analog phone line somewhere in 1991.

The last three lines below in the bash terminal output snippet should answer the question if my machine is slow. And this was a make clean all from the command prompt. I like to see all the stuff the shell/terminal throws up as it goes through the copile and link proces :-D Line # 17,18 and 19 will be of interest.
Code: Bash  [Select][+][-]
  1. real    2m12.537s
  2. user    1m35.501s
  3. sys     0m7.744s

Nice. Not slow.
Did you know that rebuilding Lazarus from its Tool menu is even faster because it compiles packages in parallel? The more CPU cores you have, the faster it compiles.
This is true both for your own projects and for a Lazarus rebuild.
I did not know this. Thank you I will test this.

OK, my picture in wiki developer pages is also outdated. I guess I should take a new picture of myself.
Volvo's 5-cylinder engines have a unique sound, also partly because of its crankshaft angles and exhaust manifold design. Somebody wrote it sounds like a baby-10-cylinder engine.
 https://www.youtube.com/watch?v=5FQh79xgaK0
More Volvo exhaust fumes: https://www.youtube.com/watch?v=DybVpNuPKFU  Swedish commentator  :)
That first video link you sent from 0:06 seconds to 0.16 seconds it sounds like a motorbike accelerating and if we go put wings on that am betting that set of wheels is going to take off just like an airplane. Haha Swedish commentator huh? Whoever who made the video has a great sense of humour :-D

One more out of topic picture, taken today :
 https://drive.google.com/file/d/1-2-42qMzRCKdcVJEPjAMPQCJdvFMtmFq/view
We have almost 40 cm of snow. There was never so much snow in southern Finland in mid-December during my lifetime. Ice age coming!
Temperature early this morning was -23°C.
It will be -40 in the evening in Edmonton this coming Wednesday 21st of December. I have attached a screenshot. Ice age never left places like Nunavit normal daytime temperature is usually below 20 degrees celsious. I have attached a screenshot.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 20, 2022, 12:01:09 am
I wanted to test the examples window just like any other stand-alone if I can do that it will save me a lot of time compared to always git fetch then git merge then rebuild the ide (which can be a real pain when you have to do it many times). So how do I get it to run like any other stand alone then?

No, no need to git fetch. Just pull. If you have made a lot of local changes, easy to revert them with git checkout <file> unless you want to keep them.  Un like Juha, I always do a make clean before make. Just to be sure.  You don't need to do that pull that often, look on gitlab and see if any changes have been made in the specific area you are working in, if not, don't be in too much of a rush to pull.
  Oh-kay will do :-)

Quote from: Aruna
I was not aware we had a repositery full of online examples somewhere. Or is this yet to be done?
Open the Examples Window, select a project and click "View in Browser".
I just tried this and very nice, good stuff!
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 20, 2022, 12:09:35 am
@JuhaManninen and @dbannon I was wondering since we now have an examples window that works is it really necessary to keep testall?

My brain and logic says get rid of it so the repository stays slim and trim but my heart says that testall has some "Guys, look how clever I am.." type of code that I do not usually prescribe to but it does demonstrate techniques that can benefit a more advanced user ( even a determined and very keen beginner I would think ) so I am drawn two ways with this.

So what do I do? Keep hacking away as and when time permits me to and then send in a pull request or forget about keeping testall alive in the repository but keep it alive on my local system? Please do advise and guide.
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 20, 2022, 12:34:49 am
@JuhaManninen and @dbannon I was wondering since we now have an examples window that works is it really necessary to keep testall?
No, not in my opinion. But I was looking for "examples" not "test apps". From memory it uses some depreciated techniques and, probably as you say, clever code. But clever code is often hard to make cross platform and maintain.

If you have some available time, I think, personally, it would be far better spent dealing with some of the "needs work" example projects. They are ones that I thought demonstrated useful techniques but had (usually) minor issues that detracted from the overall "gloss".

Just my humble opinion.

Davo
Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 20, 2022, 11:11:12 pm
@JuhaManninen and @dbannon I was wondering since we now have an examples window that works is it really necessary to keep testall?
We classified it as a test instead of an example. It can be added to lcl/tests. Just fix the clear bugs you found, no need to improve it further.
Even if you plan to improve it more later, you should publish it soon. FOSS development, remember.
Yes, there is plenty of other code to improve, in examples and elsewhere. For example Lazarus project has now 2153 open issues.
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/?sort=updated_desc&state=opened
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 20, 2022, 11:32:24 pm
@JuhaManninen and @dbannon I was wondering since we now have an examples window that works is it really necessary to keep testall?
We classified it as a test instead of an example. It can be added to lcl/tests. Just fix the clear bugs you found, no need to improve it further.
Even if you plan to improve it more later, you should publish it soon. FOSS development, remember.
Yes, there is plenty of other code to improve, in examples and elsewhere. For example Lazarus project has now 2153 open issues.
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/?sort=updated_desc&state=opened
I will try to send you a pull request by this weekend. Since I started working again time has become a very limited commodity for my personal projects.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 20, 2022, 11:34:24 pm
@JuhaManninen and @dbannon I was wondering since we now have an examples window that works is it really necessary to keep testall?
No, not in my opinion. But I was looking for "examples" not "test apps". From memory it uses some depreciated techniques and, probably as you say, clever code. But clever code is often hard to make cross platform and maintain.

If you have some available time, I think, personally, it would be far better spent dealing with some of the "needs work" example projects. They are ones that I thought demonstrated useful techniques but had (usually) minor issues that detracted from the overall "gloss".

Just my humble opinion.

Davo
Juha said put it under lcl/tests so that is what I am going to do and I will start working on the "needs work" example projects soon.
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 21, 2022, 02:13:02 am
@JuhaManninen and @dbannon I just moved all 'testall' files to lcl/tests in branch fixes_2_2 on my local repository and pushed to my remote everything went well. Now when I try to create a merge request gitlab starts complaining please see attached screenshot. Do I start a new thread or this is related so it is ok to discuss this here?

Another issue is how do I keep 'my' forked repository in 'sync' with FPC / Lazarus / Lazarus  (https://gitlab.com/freepascal.org/lazarus/lazarus) please?
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 21, 2022, 04:52:23 am
I find gitlab a great deal harder to work with than github I am afraid. While you can sync the remote from the web view on github, on git lab you need to fetch from the official lazarus and push that up to your own remote gitlab repo. Its very messy IMHO.

Sorry, I don't have my notes available right now so cannot be explicate. The broad idea is that you must try and keep your remote close to the Lazarus one. These changes you made to testall should be contained all in the one directory ?  If so, I'd consider tucking them away some where safe locally and cleaning out your repo, and, maybe even your remote one !

I know its not the git way of thinking but your changes will be self contained, easily grafted back into a fresh repo when you have tidied up.

Davo
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 21, 2022, 08:55:16 pm
I find gitlab a great deal harder to work with than github I am afraid. While you can sync the remote from the web view on github, on git lab you need to fetch from the official lazarus and push that up to your own remote gitlab repo. Its very messy IMHO.

Sorry, I don't have my notes available right now so cannot be explicate. The broad idea is that you must try and keep your remote close to the Lazarus one. These changes you made to testall should be contained all in the one directory ?  If so, I'd consider tucking them away some where safe locally and cleaning out your repo, and, maybe even your remote one !

I know its not the git way of thinking but your changes will be self contained, easily grafted back into a fresh repo when you have tidied up.

Davo
Yes, I fully agree GitLab can be a royal pain most times. So.. *nuke* my forked repo? Blow it away and start with a fresh clean fork? You are right you know... I have probably messed up my local repo. But how does one fetch/pull from lazarus main/trunk and make changes and push to 'my fork?' If you have any notes now is a good time to share them mate..   
Title: Re: Bugs in Example Projects window
Post by: dbannon on December 22, 2022, 12:25:27 am
Oh, you do not have to blow it away, there will definitely be a 'git way' to get to where u need be. But that might take more reading than you want to do ....

Davo
Title: Re: Bugs in Example Projects window
Post by: Aruna on December 22, 2022, 12:40:11 am
Oh, you do not have to blow it away, there will definitely be a 'git way' to get to where u need be. But that might take more reading than you want to do ....

Davo
I think it will be easier to start from scratch instead of wasting any more time trying to fix whatever it was that I must have done that has caused git to hiccup. And then hopefully try and keep everything synced daily. I do not mind reading but right now with work and other daily involvements, time has become scarce and very limited.

So I have to
- fork the Lazarus Repo, then..
- clone the fork to my local system, then..
- somehow get the local repo to fetch/pull from the original Lazarus main/trunk.

David, how did you go about doing this, please? I am stumped ( for now.. )


Title: Re: Bugs in Example Projects window
Post by: JuhaManninen on December 22, 2022, 08:34:50 am
Do I start a new thread or this is related so it is ok to discuss this here?
We have the "TestAll" project issues thread. I answer there.
 https://forum.lazarus.freepascal.org/index.php?topic=61546

@dbannon, I added a modified version of the ListViewFilterEdit example project. See issue:
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40035
TinyPortal © 2005-2018