Help/Suggestion with ModifiedClick bindings

#0 - June 23, 2008, 12:10 a.m.
Blizzard Post
I would like to use ModifiedClick bindings in my addon to define arbitrary button presses, whether modified or not. For example, one modified click might be bound to "ALT-BUTTON2", while another could be bound simply to "BUTTON2". The modified click interface is desirable here because of its uniformity throughout the UI and flexibility of available options.

However, if my mod defines a modified click to a non-modified value (i.e. "BUTTON2"), it breaks quite a few areas of the default UI. I will use the SetItemRef function as an example of why this happens.

SetItemRef checks "IsModifiedClick()" to determine if any modified click applies, and if so jumps directly to "HandleModifiedItemClick". Notice that it catches all modified clicks, no matter if they apply to item links or not. This has problematic implications beyond my issue as well. Imagine that all itemlink-related modified clicks were remapped to "SHIFT-BUTTON[1-5]", and the unrelated SPLITSTACK modifier was set to "ALT". In that case, clicking an itemlink with alt held would do nothing at all, for any context.


I propose a change in how the default UI catches modified clicks to allow for such cases. Throughout most of the default UI, modified clicks are handled as such:if ( IsModifiedClick() ) then
HandleModifiedClick();
else
HandleNonModifiedClick();
endMy suggestion is to have all functions like "HandleModifiedClick" reserve a return value for completely unhandled modifiers. One possible solution could return nil when not handled, true when handled and action was taken, and false for when handled but no action was taken. Using this new method, the earlier function could be rewritten to only intercept clicks it can handle:if ( not IsModifiedClick() or HandleModifiedClick() == nil ) then
HandleNonModifiedClick();
end
#3 - June 26, 2008, 11:30 p.m.
Blizzard Post
Hey Biozera, thanks a lot for the suggestion. We'll look into implementing this in a future patch!