ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Add item to the keybind bar? (https://www.esoui.com/forums/showthread.php?t=1011)

katkat42 04/18/14 11:13 PM

Add item to the keybind bar?
 
You know the keybind bar, that bar at the bottom of the vanilla UI elements, that says, for example when looting, "Take [E]" "Take All [R]" "Exit [Alt]" ? Does anyone know how to add my own button to the pre-existing bar?

I know the bar is controlled by the KEYBIND_STRIP global. I know there are functions within this variable called AddKeybindButton(), AddKeybindButtonGroup(), and AddButtonToAnchors(). Does anyone know the arguments that these functions might take?

Also, when do I call the function to add the keybind to the bar? Do I call when the provisioning window opens? Sometime before or after? Do I trigger it with an event callback?

Thanks in advance!

Xrystal 04/18/14 11:50 PM

Have a look at this thread.

I had a quick dabble when the question was asked in game and got a basic one running.

But, I think you need to combine the display with the custom binding table which I didn't play with.

Although, it wasn't to the existing bar.

Halja 04/19/14 06:28 AM

http://www.esoui.com/forums/showthread.php?t=820

There is some additional linking going on to make the work. It appears to be something with the RootGUI and/or scene manager and callbacks. They could of buried it deeper but why would they expose they keybind strip in the API? :confused:

--halja

katkat42 04/19/14 09:22 AM

Thank you! I'll fiddle around with that today.

katkat42 04/19/14 02:04 PM

Okay, here's how it goes. The function to put a button (or button group) to the keybind bar is as follows:
Code:

KEYBIND_STRIP:AddKeybindButtonGroup(keybindStripDescriptor)
...where keybindStripDescriptor is as follows:
Code:

local keybindStripDescriptor =
{
        { -- I think you can have more than one button in your group if you add more of these sub-groups
                alignment = KEYBIND_STRIP_ALIGN_CENTER,
                name = "Craft All",
                keybind = "UI_SHORTCUT_TERTIARY",
                callback = function() CookAllStart() end,
        },
}

Put the first segment of code in your callback for the event that displays the keybind bar. In your callback for the event that un-displays the keybind bar (ie, EVENT_END_CRAFTING_STATION_INTERACT), put this line:
Code:

KEYBIND_STRIP:RemoveKeybindButtonGroup(keybindStripDescriptor)
I think there might be a more graceful way to do it when there's already some buttons there, but this is one way to do it.


All times are GMT -6. The time now is 11:31 AM.

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