Thread Tools Display Modes
04/18/14, 11:13 PM   #1
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
Question 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!
  Reply With Quote
04/18/14, 11:50 PM   #2
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
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.
  Reply With Quote
04/19/14, 06:28 AM   #3
Halja
 
Halja's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 111
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?

--halja
  Reply With Quote
04/19/14, 09:22 AM   #4
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
Thank you! I'll fiddle around with that today.
  Reply With Quote
04/19/14, 02:04 PM   #5
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
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.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Add item to the keybind bar?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off