View Single Post
  #5  
Unread 06-14-2016, 07:35 PM
Thurallor's Avatar
Thurallor Thurallor is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: May 2013
Posts: 202
Quote:
Originally Posted by Hamkaas
2. When i make a quickslot and bind an alias shortcut to it, can i somehow make it do something extra when you click it? like do the alias shortcut and perform commands. If i try to catch the mouseclick event it does not seem to be willing to do both. At the moment i'm using a workaround by catching the message it sends in the chat and then run the commands from that but it is too slow for what i want to use it for and also not very elegant.
If I understand the question correctly, there is nothing preventing you from doing this, and I depend on this functionality in some of my plugins.

But I just do it the obvious way, which makes me think I am misunderstanding the question. Example:
Code:
import "Turbine.UI.Lotro";

win = Turbine.UI.Window();
win:SetVisible(true);

shortcut = Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias, "/laugh");
quickslot = Turbine.UI.Lotro.Quickslot();
quickslot:SetShortcut(shortcut);
quickslot:SetParent(win);
quickslot:SetUseOnRightClick(false); -- don't execute the shortcut when the user right-clicks

quickslot.MouseClick = function(sender, args)
    if (args.Button == Turbine.UI.MouseButton.Left) then
        Turbine.Shell.WriteLine("left-click");
    elseif (args.Button == Turbine.UI.MouseButton.Right) then
        Turbine.Shell.WriteLine("right-click");
    end
end
Reply With Quote