Thread Tools Display Modes
08-15-09, 10:46 AM   #1
Cidwel
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 23
Showing frames by holding a button

Hi all! I'm trying to code a simply frame with useful macros and I would to show it only if I hold a key, P.e, pressing alt. I cannot do it with:

if IsAltKeyDown() then
frame:Show();
else
frame:Hide();
end

should I need to use a trigger? Thanks in advance

Last edited by Cidwel : 08-15-09 at 11:19 AM.
  Reply With Quote
08-15-09, 01:57 PM   #2
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
You can define a key for your addon in the bindings.xml and set the attribute 'runOnUp="true"'. There you can get the state of the pressed key and react if it's currently pressed or not.
See the bindings.xml example on WoWWiki. The second <Binding> in the first example is most likely the one you need.

Another method would be to set a script for the handlers OnKeyDown / OnKeyUp, but you'd have to check which key is pressed, because it fires on each one.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Showing frames by holding a button


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