ListView control - Error when pressing escape key with any mouse event enabled
I'm trying to find out the issue with mouse events in the listview dotnet control and pressing escape.
At the bottom, is the code.
If you block out all the on lv <eventname>
's, then there's no error.
The only way to remove the error and keep the code is to add this:
on lv KeyUp e do ( if e.keyvalue == 27 do lv.dispose() --print (e.keyvalue as string + " - Escape KeyUp") )
Which isn't ideal.
Here's the full code, just run it and hit escape a few times for the JIT error to appear:
try(destroyDialog lvRol)catch() clearListener() rollout lvRol "ItemMouseHover - Help Required" height:300 width:500 ( -- functions local _lvInit, _lvPopulateList, _lvAddColumns, _lvIsFormReadyToFocus dotNetControl lv "system.windows.forms.listView" height:(lvRol.height) width:(lvRol.width-1) pos:[0,0] fn _lvInit lvArg = ( lvArg.view = (dotNetClass "system.windows.forms.view").details lvArg.FullRowSelect = true lvArg.MultiSelect = true ) fn _lvPopulateList lvArg = ( rows = #() for x in objects do ( li = dotNetObject "System.Windows.Forms.ListViewItem" x.name li.tag = dotnetmxsvalue x li.subitems.add ((classOf x) as string) li.subitems.add (((x.wireColor) as point3) as string) append rows li ) lvArg.items.addRange rows ) fn _lvAddColumns lvArg columnsAr = ( w = (lvArg.width/columnsAr.count)-1 for x in columnsAr do ( lvArg.columns.add x w ) ) on lv MouseCaptureChanged do (print "MouseCaptureChanged") on lv MouseClick do (print "MouseClick") on lv MouseDoubleClick do (print "MouseDoubleClick") on lv MouseDown do (print "MouseDown") on lv MouseEnter do (print "MouseEnter") on lv MouseHover do (print "MouseHover") on lv MouseLeave do (print "MouseLeave") on lv MouseMove do (print "MouseMove") on lv MouseUp do (print "MouseUp") on lv MouseWheel do (print "MouseWheel") on lvRol open do ( _lvInit lv _lvAddColumns lv #("Object", "Class", "Wire Color") _lvPopulateList lv ) ) createDialog lvRol
Comments
Narrowed down the problem
I've been revisiting this issue today and I've narrowed down the problem to the MouseDown event handler.
Removing this removes the error completely.
See line 45-48 of the below code.
.
it must be something else that causes this error.
I've checked your code in max2014 and it works fine
`
one thing I noticed is there are no sender and event parameters. Did you try with them already?
.
That's been done too. Have you tried in 2020?
I'm using 2020
Thanks for checking this. Just to confirm that you clicked inside the listview before you pressed escape a few times?
.
sure, I clicked whereever possible
Just checked it in 2020 now and I confirm that it throws an error on esc
:(
Oh, that's good to know. I
Oh, that's good to know. I was sure I was going mad! :P Thanks.
I'll check to see if this has been fixed with a service pack or send this on to them.