Cancel MouseWheel event in WebListBox

I want to disable the Mouse Wheel in a WebListBox.

I have found a way to disable the MouseWheel event for the whole page with JavaScript e.preventDefault(); but still, when the cursor is over the ListBox it reacts to the wheel.

Also, I do not seem to be able to get a WebListBox element by name, as I would with a TextField :

ExecuteJavascript("document.getElementsByName('ListBox1')[0].id= 'lbctr' ;  " )

Insight, links, pointers will be greatly appreciated. Thank you in advance.

Forgive me if this isn’t the right answer (I don’t use the web edition), but in the desktop version I’d simply RETURN TRUE in the MouseWheel event for the listbox…?

Guess what ? There is no MouseWheel event in WE !

Hence the need to go JavaScript …

OK; hard to know when I don’t use it and the language reference doesn’t seem to say which editions it’s in… thought it was worth a go, though - sometimes the simplest things can be overlooked (I know from bitter experience!) :slight_smile:

Thank you for trying. In tried to cover the ListBox with a canvas to intercept the event. It catches MouseDown, but not MouseWheel.

As I explained I have succeeded to suppress the MouseWheel avent in the whole page, but for some reason, the WebListBox still catches it. I guess I hope someone else will have a bright suggestion :wink:

Hi Michel -
I run in to this a lot when I want to have webdialogs over weblistboxes. What I do, when the webdialog is active (in the Open or Shown event), is I disable the weblistbox. Once the user is done with the webdialog, I enable the weblistbox. Not sure if that will work for your situation, but I do this frequently in my code.

I know this is clear, but for completeness - I use the WebListbox.Enabled = true/false for this.

[quote=112719:@Mark Pastor]Hi Michel -
I run in to this a lot when I want to have webdialogs over weblistboxes. What I do, when the webdialog is active (in the Open or Shown event), is I disable the weblistbox. Once the user is done with the webdialog, I enable the weblistbox. Not sure if that will work for your situation, but I do this frequently in my code.[/quote]

Thanks Mark. It is a nice tip for your concern. However, in my case, I need the WebListBox appearance to remain as ‘active’. What is raging is that I found a way to disable the MouseWheel in all the page, but not in the ListBox. Just the exact opposite of what I want to achieve. Yesterday I even tried to cancel the event for the class name ‘listbox’ in JavaScript, and it does nothing.

I can get the Mouse Wheel value through JavaScript, so if I could suppress the event in the WebListBox, it would become possible to manage scroll through ScrollTo and in the process gain access to ScrollPosition, ie to know which row is shown on top of the control.

If I find no way to prevent the mouseWheel event in the WebListBox, I will probably have to create a custom class. But that is a heck of a job with the over 40 properties to recreate, and the some 20 events to echo somehow.