ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Modify menu when right click on item? (https://www.esoui.com/forums/showthread.php?t=1411)

f1gm3nt 05/07/14 08:40 PM

Modify menu when right click on item?
 
Is it possible to add another option when someone right clicks on an item? There's an addon I'd like to make to learn a few things, and it would be helpful to be able to right click on an item and have another option that the player is able to select.

If anyone knows of any addon that does this or any thread in the forums (I tried searching, but no results) would you mind letting me know?

Thanks in advanced.

ingeniousclown 05/07/14 08:49 PM

I do this in my ItemSaver addon. It's an incredibly hacky way to do it, and I'm sure there's a better way to do it, but I don't know about it if there is.

Feel free to take a look at my code :)

f1gm3nt 05/07/14 08:57 PM

I will, thank you.

Kentarii 05/08/14 02:38 AM

In my addon, I have a TextBuffer and TextLabel where I create custom links to do various actions.

XML:
Code:

          <OnLinkClicked>
            HoWUI.QuestJournal:OnLinkClicked(self, linkData, linkText, button, ctrl, alt, shift, command)
          </OnLinkClicked>

Lua:
Lua Code:
  1. --- Event handler for OnLinkClicked in TextBuffer control.
  2. -- @param self
  3. -- @param linkData string the link url:     url:SomeLinkTargetOrUrl[SomeLinkText]
  4. -- @param linkText string the link text:    [SomeLinkText]
  5. -- @param button int the mousebutton clicked, 1 = left, 2 = right, 3 = middle
  6. -- @param ctrl bool true if ctrl was pressed during click.
  7. -- @param alt bool true if alt was pressed during click.
  8. -- @param shift bool true if shift was pressed during click.
  9. -- @param command bool true if command (Mac I assume) was pressed during click.
  10. -- @return void
  11. function module:OnLinkClicked(_self, linkData, linkText, button, ctrl, alt, shift, command)
  12.     local linkType, arg1, arg2 = zo_strsplit(":", linkData)
  13.     if linkType == "quest" then
  14.         local zoneName = arg1
  15.         local questName = arg2
  16.         if button == 1 then
  17.         -- left click
  18.         elseif button == 2 then
  19.         -- right click
  20.         end
  21.     elseif linkType == "filter" then
  22.         local state = tonumber(arg1)
  23.         if button == 1 then
  24.         -- snip
  25.         end
  26.     elseif linkType == "zone" then
  27.         local zoneName = arg1
  28.         if button == 1 then
  29.         end
  30.     end
  31. end


Links:
Code:

|H6699FF:quest:ExampleZoneName:SomeQuestName:|hSomeQuestName|h
|HFF9933:zone:ExampleZoneName:|hExampleZoneName|h
|HFFFFFF:filter:1:|h123|h

You can also check this page for more info
http://wiki.esoui.com/How_to_create_custom_links


All times are GMT -6. The time now is 01:04 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI