This problem is associated with the ItemMouseHover
event handler or other mouse handlers described below. If removed, ItemMouseHover
(in my case) the problem goes away.
Update
Here's some very basic code that throws the same error as below.
MouseMove
event handlier is also added to the culprit list along with ItemMouseHover
as originally posted.
try destroyDialog lvRol catch()
rollout lvRol "MouseMove - Help Required" height:300 width:500
(
local me = lvRol
dotNetControl lv "system.windows.forms.listView" height:(me.height) width:(me.width) pos:[0,0]
on lv MouseMove sender e do print "I like to move it, move it, moooove it!"
)
createDialog lvRol
Here's a gif showing the issue
Here's a link to the error code
I've tried to add the function _lvIsFormReadyToFocus
but this didn't work.
I've removed this altogether from the full code below and the problem no longer arises.
on lv ItemMouseHover do (
if _lvIsFormReadyToFocus lv then print "Hovering"
)
The problem also happens with other mouse events such as: MouseMove
, MouseUp
, MouseDown
Here's the code and the problem of the code is at line #33.
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
)
)
fn _lvIsFormReadyToFocus form = (if form.CanSelect and form.CanFocus and form.Focused then return true else return false)
/*
HELP REQUIRED HERE for ItemMouseHover
This throws an error after I press ESC when no items are selected, I get a JIT error.
Steps to reproduce:
1. Add a few objects to a scene for this to show any items in the list.
2. Run this script.
3. Hold Control key and left click and drag to select.
4. Hold Alt key and left-click and drag to de-select.
5. Deselect any items.
6. Once there are no items selected press ESC a few times until the error occurs.
*/
on lv ItemMouseHover do (
if _lvIsFormReadyToFocus lv then print "Hovering"
)
on lvRol open do
(
_lvInit lv
_lvAddColumns lv #("Object", "Class", "Wire Color")
_lvPopulateList lv
)
)
createDialog lvRol --pos:[1240,600]