TListbox click/mouse events

MarcusF · 470

MarcusF

  • Newbie
  • *
    • Posts: 38
    • Karma: +11/-0
on: July 13, 2022, 07:26:33 PM
I figured I'd start writing some software for AROS, but I've run into an issue..

I need a listbox (Or equivalent) and while it renders fine, none of the onclick or mouse events appear to fire.
It selects the item but does not trigger the events.

Anyone run into this, got a fix or workaround?

I'm happy to put some bounty money for AROS FPC/Lazarus fixes.



MarcusF

  • Newbie
  • *
    • Posts: 38
    • Karma: +11/-0
Reply #1 on: July 13, 2022, 07:33:05 PM
My dirty solution is to use a timer set for 500ms and track if the listbox.itemindex has changed..



magorium

  • Moderator
  • Legendary Member
  • *****
    • Posts: 506
    • Karma: +55/-0
  • Convicted non contributor
Reply #2 on: July 13, 2022, 08:55:44 PM
I figured I'd start writing some software for AROS, but I've run into an issue..

I need a listbox (Or equivalent) and while it renders fine, none of the onclick or mouse events appear to fire.
It selects the item but does not trigger the events.

Anyone run into this, got a fix or workaround?

I'm happy to put some bounty money for AROS FPC/Lazarus fixes.
Hello Marcus.

Nice to see you back. Gives me an opportunity to thank you for your blogposts on Free Pascal. Always nice reads !  :)

I believe/think the TListBox currently does not support the onchange/onclick events. Seems that ALB42 also used a workaround for EdiSyn (more about EdiSyn on his blog here) where you can see a TListBox being used for the preferences window.

Current state of Lazarus/MUI LCL can be read here.

There haven't been lot of improvements on the MUI LCL, instead ALB worked/improved quite a bit on his MUIClasses, which allow you to program native MUI widgets.
« Last Edit: July 13, 2022, 09:06:56 PM by magorium »



MarcusF

  • Newbie
  • *
    • Posts: 38
    • Karma: +11/-0
Reply #3 on: July 13, 2022, 10:54:42 PM
Thank you! I'm glad you like them  :)

I need to finish the series on OWASP Top 10 some day...

That's really cool, didn't know ALB was working on that, will have to check it out!

I was going to have a go at implementing the small things I need for this project but I'm not sure how to make FPC/Laz use my modified sources. I don't do this work very often :(



magorium

  • Moderator
  • Legendary Member
  • *****
    • Posts: 506
    • Karma: +55/-0
  • Convicted non contributor
Reply #4 on: July 13, 2022, 11:53:45 PM
I need to finish the series on OWASP Top 10 some day...
I did see that you were making some preparations/experiments wrt to that topic in your repositories.

I assume you were (too) busy to keep up your blog-posting-rate ?

Quote
That's really cool, didn't know ALB was working on that, will have to check it out!
It is indeed. Most of the bigger programs he currently works/worked on are made with those classes (MUIMapparium, Leu and AmiTube for example, for more information on those see his blog)

Quote
I was going to have a go at implementing the small things I need for this project but I'm not sure how to make FPC/Laz use my modified sources. I don't do this work very often
It depends.

If it is about Free Pascal and not being compiler and/or system unit related then you can put your modified sources either next to your project or add the directory where you put them at the fpc commandline (or fpc.cfg). That way it will override the default used units.

With regards to Lazarus, that might become a bit more complicated, especially when it comes to modifications to/for graphical components.

That more or less requires you to rebuild lazarus and/or your modifications into lazarus itself.

Nothing that commandline lazbuild (or Lazarus IDE itself) can't solve for you but you need to know where exactly to put/place your modifications.

I'm not very proficient with making modifications to a Lazarus widgetset as well. I usually opt for the road of least resistance meaning copying out the files i want to modify then make my modifications in those copied unit-sources, then create a diff file, and run that diff over the original sources to finally (re)build lazarus and widgetset again to see what happens  :)

Ofc using something like git creating a branch for your modifications simplifies that process because you can start messing with original files. As a bonus the diff becomes easier to create, based on whatever other branch and you could opt for pushing your changes.

What Lazarus setup are you currently using for developing for AROS ? Are you using ALB42's crossamigalazarus docker (https://github.com/alb42/crossamigalazarus) ? or do you use your own setup ? What is your host-platform ?

With regards to improving things, we are all quite busy and any help is welcome, if even reporting experience/bugs. MUI widgetset for Lazarus is a bit of hit and miss though, because of some fundamental differences between MUI and Lazarus widgetsets (how the basic flow of a widget is implemented). In that regards it would have been easier/more logical to opt for Intuition/gadtools but that has it's own shortcomings (ALB42 started out with with a Intuition based LCL widgetset)

fwiw in case you already know all this then please ignore but i am able to understand you did not kept all this in your knowledge base since last time we talked about it (on the old forums)  ;D


magorium

  • Moderator
  • Legendary Member
  • *****
    • Posts: 506
    • Karma: +55/-0
  • Convicted non contributor
Reply #5 on: July 14, 2022, 12:12:39 AM
My dirty solution is to use a timer set for 500ms and track if the listbox.itemindex has changed..
That might work.

Do realise though that the itemindex in a listbox can also be set programmatically and in that case you do not (always) wish for a click event to fire. Perhaps something to keep in mind.


MarcusF

  • Newbie
  • *
    • Posts: 38
    • Karma: +11/-0
Reply #6 on: July 14, 2022, 12:17:20 AM
I have too many projects  :o  haha

Yes I was planning a whole series, one post for each Top 10 item but got too busy. I still plan to write more articles though youtube videos seem to get more visits.

I have two serious projects for AROS planned and am working on the easiest one first: AROSNote, a cloud powered multiplatform note system with auto sync between your notes. Kind of like OneNote. So write a note in AROS, it's automatically backed up in the cloud and you can view and edit the notes on your Windows machine, or another AROS machine, etc.

Networking works, and creating webserver backends is easy, I just have to figure out the platform details and quirks, like no onclick for lists. Turns out onDoubleClick works though so I can work around that.

If I can create this software I will go on to the second more complicated one.

My development setup is
* Windows 11 Pro
* FreePascal 3.2.2
* Lazarus 2.2.0
* VirtualBox with an AROS VM
* FileZilla server on the host and MarranoFTP on AROS

It works very well. I created the setup using FPCUpDeluxe for cross compiler setup.

One reason I'm reticent to use ALBs MUI tools is that right now AROSNote is cross platform with almost no extra work (little workaround for click and such)



MarcusF

  • Newbie
  • *
    • Posts: 38
    • Karma: +11/-0
Reply #7 on: July 14, 2022, 12:26:26 AM
My dirty solution is to use a timer set for 500ms and track if the listbox.itemindex has changed..
That might work.

Do realise though that the itemindex in a listbox can also be set programmatically and in that case you do not (always) wish for a click event to fire. Perhaps something to keep in mind.

Turns out the OnDblClick works for listbox so I just did a quick one like this

Code: [Select]
procedure TForm2.NotesListboxDblClick(Sender: TObject);
begin
  NotesListboxClick(Sender);
end;



Amiwell

  • Legendary Member
  • *****
    • Posts: 2189
    • Karma: +32/-4
  • Peace
Reply #8 on: July 14, 2022, 02:43:56 AM
Welcome :)


MarcusF

  • Newbie
  • *
    • Posts: 38
    • Karma: +11/-0
Reply #9 on: July 14, 2022, 03:42:57 AM
Thanks salvo!



AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 2668
    • Karma: +64/-1
  • AROS One
    • AROS One
Reply #10 on: July 14, 2022, 08:00:04 AM
Welcome to the forum MarcusF


Amiwell

  • Legendary Member
  • *****
    • Posts: 2189
    • Karma: +32/-4
  • Peace
Reply #11 on: July 14, 2022, 02:40:22 PM
Thanks salvo!

You are welcome I'm glad you write software, I use Aros every day, I don't use Windows and not even Linux this because at the moment the web browser allows me :D


MarcusF

  • Newbie
  • *
    • Posts: 38
    • Karma: +11/-0
Reply #12 on: July 14, 2022, 02:53:06 PM
Thanks amigasystem :)

That's really cool Salvo! Anything you miss from Linux or Windows?



magorium

  • Moderator
  • Legendary Member
  • *****
    • Posts: 506
    • Karma: +55/-0
  • Convicted non contributor
Reply #13 on: July 14, 2022, 03:08:41 PM
Yes I was planning a whole series, one post for each Top 10 item but got too busy. I still plan to write more articles though youtube videos seem to get more visits.
Looking forward to those. Youtube he ? lemme try if i can find that  :)

Quote
I have two serious projects for AROS planned and am working on the easiest one first: AROSNote, a cloud powered multiplatform note system with auto sync between your notes. Kind of like OneNote. So write a note in AROS, it's automatically backed up in the cloud and you can view and edit the notes on your Windows machine, or another AROS machine, etc.
Sounds interesting. That more less forces you to stay/stick with the LCL, got it.

Quote
Networking works, and creating webserver backends is easy, I just have to figure out the platform details and quirks, like no onclick for lists. Turns out onDoubleClick works though so I can work around that.
Feel free to give a yell in case you run into troubles on that. Although I do admit i have not been using MUI LCL for quite some time now.

Quote
My development setup is
Thank you for posting your setup. It'll helps to know what your options are.

Glad to hear you got things working and setup the way you want them to be.

Myself I use linux with FPCP 3.3.1(working on the compiler/RTL atm) and am actually not using Lazarus atm (I mostly work on a remote machine atm). AROS is running hosted (native) on a linux machine (that way I do not have to mess with VM's, and its easier wrt debugging and swapping in/out files as everything is just located inside a Linux directory).

Quote
One reason I'm reticent to use ALBs MUI tools is that right now AROSNote is cross platform with almost no extra work (little workaround for click and such)
Yeah, see my earlier note on that. I fully understand the preference for using LCL.

Hope you succeed and have some fun along the way. Happy coding !  :)


Amiwell

  • Legendary Member
  • *****
    • Posts: 2189
    • Karma: +32/-4
  • Peace
Reply #14 on: July 14, 2022, 03:23:08 PM
Thanks amigasystem :)

That's really cool Salvo! Anything you miss from Linux or Windows?

I use a lot of the web browser, to go to the forums that talk about Amiga in general and then use some services that fortunately work still but, there would be a need for an update even if it is still usable within certain limits