Recent

Author Topic: Bugs in Example Projects window  (Read 10564 times)

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Bugs in Example Projects window
« Reply #30 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
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Bugs in Example Projects window
« Reply #31 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.
« Last Edit: December 10, 2022, 08:44:53 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Bugs in Example Projects window
« Reply #32 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.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Bugs in Example Projects window
« Reply #33 on: December 11, 2022, 04:37:32 am »
@Aruna, I will create a new thread about TestAll project issues.
Ok sounds good to me.

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Bugs in Example Projects window
« Reply #34 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..

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Bugs in Example Projects window
« Reply #35 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

balazsszekely

  • Guest
Re: Bugs in Example Projects window
« Reply #36 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

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Bugs in Example Projects window
« Reply #37 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?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Bugs in Example Projects window
« Reply #38 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 ??
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

balazsszekely

  • Guest
Re: Bugs in Example Projects window
« Reply #39 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.  :)

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: Bugs in Example Projects window
« Reply #40 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');

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Bugs in Example Projects window
« Reply #41 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.
« Last Edit: December 12, 2022, 06:03:39 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Bugs in Example Projects window
« Reply #42 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.
« Last Edit: December 13, 2022, 12:58:04 pm by Aruna »

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Bugs in Example Projects window
« Reply #43 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
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Bugs in Example Projects window
« Reply #44 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.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018