Thread Tools Display Modes
12-14-09, 07:23 PM   #1
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
oUF_TotemBar Question

Yes, it is me again with a crazy question! I was wondering how I could implement this function into the oUF_TotemBar.lua. I have no idea what else I should add... maybe someone can give me an idea on how to do this? :O Im trying to make it to where you right click and it destroys the totem, here is my code and its ugly and im not sure what else i have to add

Code:
OnClick = function(self,TotemBar)
			
			if button == "RightButton" then
			
			DestroyTotem(1);
			DestroyTotem(2);
			DestroyTotem(3);
			DestroyTotem(4);
			
			end
			
		end
Adding this to the oUF TotemBar and im trying, but its like i have to add something else to make it to where its not clicking through? THanks for any help and sorry for me being so bothersome with questions!
  Reply With Quote
12-14-09, 07:28 PM   #2
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
I realized... would I need xml for this? Sorry for my noobness, but i realized it would make it a widget?
  Reply With Quote
12-15-09, 12:42 AM   #3
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Is your statusbar frame clickable ?
Maybe a :EnableMouse(true) would do the trick.
  Reply With Quote
12-15-09, 01:19 AM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
As of 1.12 XML is only* needed for templates. What you most likely need to do is:
Lua Code:
  1. button:RegisterForClicks("LeftButtonUp", "RightButtonUp")

The frame is most likely a Button already, so no need to enable mouse on it.

* We were lacking quite a few widget function back then tho', and it still happens once in a while. A lot rarer now however; Last thing I can remember was the cooldown spiral icon in 2.4.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-15-09, 03:08 AM   #5
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Now I'm in a rut. I have something similar to this, i keep re-editing it with different things (experimenting if you will) and Im not exactly positive if there is anything else I may need to add to it or where exactly I can put it.. would I put it in my oUF Layout after my oUF TotemBar style or would I put it in the oUF totembar.lua itself? Sorry if Im asking too much questions but if maybe you guys can help resolve this possibly everyone will benefit from it and be able to right click their totems off from the totembar :P Sorry again for my noobness and Im still learning and thank you for putting up with me thus far! lol

Without further or do, here is the code i have so far:


Code:
OnClick = function(self,button)

			button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
			
			if button == "RightButton" then
			
			DestroyTotem(1);
			DestroyTotem(2);
			DestroyTotem(3);
			DestroyTotem(4);
			
			end
			
		end
  Reply With Quote
12-15-09, 03:26 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You have to register the button for clicks before it can receive click events, so with your code, your OnClick handler never gets called. Also, you need to actually set the OnClick handler to your OnClick function.

Code:
button:RegisterForClicks("LeftButtonUp", "RightButtonUp")

button:SetScript("OnClick", function(self, mouseButton)
	if mouseButton == "RightButton" then
		DestroyTotem(1)
		DestroyTotem(2)
		DestroyTotem(3)
		DestroyTotem(4)
	end
end)
However, you might want to selectively destroy only the totem whose button was actually clicked on, though without seeing your actual code I couldn't tell you how to do that, since I don't know how your buttons are set up.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF_TotemBar Question


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