WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   nUI: Developer Chat (https://www.wowinterface.com/forums/forumdisplay.php?f=96)
-   -   Setting up Key Bindings... (https://www.wowinterface.com/forums/showthread.php?t=26918)

spiel2001 08-28-09 04:56 PM

Setting up Key Bindings...
 
2 Attachment(s)
Quote:

Originally Posted by lairdofdeath
ive benn looking into adding key bindings to the profesions addon i did and was hoping you could help me learn how

i pretty sure i will have to add a .xml file to it but im not sure what if anything im saposed to add to the code itself or ware im saposed to add it at

thanx in advance for your time

You need a couple of things to make key bindings work. First, you'll need an xml file that defines what key bindings your addon supports. I've attached the key binding file for nUI to this message. Each line in the file defines the bindings for a single button. The first line of each section or group of buttons also references the text label that will be displayed...

<Binding name="CLICK nUI_ActionBar_Button1:LeftButton" description="nUI_ACTIONBAR1" header="nUI_ACTIONBAR">--[[ dummy ]]</Binding>

The binding name defines the type of binding (CLICK), the button the key binding belongs to (nUI_ActionBar_Button1), the type of click (LeftButton), the key binding label for that button (nUI_ACTIONBAR1) and optionally a heading (nUI_ACTIONBAR) -- a new "group" of buttons is displayed in the key binding frame for each "header" in the XML file... look at this file and look at the key binding window and you'll start to connect the dots mentally.

Note that the name of "Bindings.xml" is case dependent on some systems. The file should be located in the root directory for your addon and it does not need to be included in the TOC. WoW will just load it if it is there.

The second thing you need is the glue code that matches the description and header to the text strings that are displayed for them.

This piece of code defines what the text label for the button will be in the key binding window..

_G["BINDING_NAME_CLICK "nUI_ActionBar_Button1:LeftButton"] = "Button #1";

And this piece of code sets the heading for the group of buttons...

_G["BINDING_HEADER_nUI_ACTIONBAR] = "nUI: Main Bar / Action Page 1";

If you look at the attached nUI_ButtonBar.lua you can see where I am setting these values up for the action bars.


All times are GMT -6. The time now is 02:33 PM.

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