View Single Post
11/26/14, 11:13 AM   #32
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Today I hit some new (to me at least) issues with FCO Item Saver at BLACKSMITHING station. I still have those greaves reserved for research in bank, but couldn't pick them for research when the research icon was green (with red/yellow I could). Also sometimes hovering over them in decon tab didn't show the blue highlight.

There're a few things wrong with your mouse handlers.

1) The biggest evil is if control:GetHandler(e) != myHandler then PreHook(e, control, myHandler) end
Someone else might hook the handler after you, and you'll end up hooking it again. If you need to keep track of what you already hooked, have an alreadyHooked[control][eventName] map. You can use the control object directly as the key, no need to GetName().

1a) After you will have fixed this, you can get rid of eventHandlers table and GetEventHandler/SetEventHandler/PreHookHandler completely.
Use ZO_PreHookHandler(control, handlerName, hookFunction) instead.

2) You're hooking "OnMouseEnter" on whole lists (e.g. DECONSTRUCTION_BAG) and there you hook OnMouseEnter of it's children. I know what led you there - rows are created later as needed - but the correct solution is to do it in dataType.setupCallback (checking alreadyHooked) or dataType.pool.m_Factory.

3) FCOItemSaver_InventoryItem_OnMouseEnter doesn't call the original handler if g_noOnMouseEvents ~= false.
Just saying, this bug will go away if you do point 1a
  Reply With Quote