Thread Tools Display Modes
03-06-09, 04:31 PM   #1
Antichrist
A Defias Bandit
Join Date: Mar 2009
Posts: 3
Right Mouseclick on LUA-Button impossible?

Good Evening Programmers ^^,

actually I'm trying to write an addon, something like Necrosis-Light, just using some Buttons. Obviously more work than I originally thought and, of course, most time spend for debugging.

I have got a quite strange problem which really drives me crazy. I'm not able to cast spells or macros from the right button click. In order to make sure that the bug is nowhere else in my code (which ist getting more and more complicated) I tried some really easy code in order to see, whether the "bug"? happens there, too.

So...here is it:

local bb = CreateFrame("Button",nil, UIParent,"SecureActionButtonTemplate")

bb:SetHeight(BUTTON_SIZE)
bb:SetWidth(BUTTON_SIZE)
bb:SetPoint("CENTER", 0, 0)
bb:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }})
bb:SetAttribute("type1","spell")
bb:SetAttribute("spell1","Angreifen")
bb:SetAttribute("type2","spell")
bb:SetAttribute("spell2","Angreifen")
bb:Show()

The spell "Angreifen" ist the german translation of "Attack", cause I'm using the german client.

I know that it makes no sense to have the same spell on both mousebuttons, but that's not the point. I choosed identical Spells in order to avoid any typing-errors.

All further addons have been deactivated, cache deleted.

I Assume that there is a little creepy, f...ing line of code missing. But i have no clue what it could be. I studies several hours of wowwiki and other page and I would give my left hand that everything should be correct.

Any Ideas for me? I'm getting weird with this little problem...

Thanks a lot in advance with greetings from the dark side of azeroth,
Val aka Antrichst
  Reply With Quote
03-06-09, 04:48 PM   #2
Foxlit
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 91
API Button RegisterForClicks is the wowwiki page you were looking for.

By default, all buttons respond to left-clicks only; you have to use that widget method if you want to handle right (or any other non-left) clicks.
__________________
... and you do get used to it, after a while.

Last edited by Foxlit : 03-06-09 at 04:55 PM.
  Reply With Quote
03-06-09, 04:57 PM   #3
Antichrist
A Defias Bandit
Join Date: Mar 2009
Posts: 3
WoW...what a quick reply. And indeed, just tested...thank you very very much.
You saved my day

I already hat Registered the RightButtonDown, but acutally this line has been disabled and I really can't remember in which combinations with the other codelines I used the RegisteredForClicks. Seems to be just badluck.

The easiest Problems are often the most diffuclt to solve.
Thx again,
Valcry

Edith just had a quick look on OPie. Very stylish and seems to be quite usefuly for daylie-quests.
Will have a look at this.

Last edited by Antichrist : 03-06-09 at 04:59 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Right Mouseclick on LUA-Button impossible?


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