Getting the text of a button when clicked
I'm modifying an existing addon that sorts people who send a tell by order of their DKP values.
so you would have a list like Joe dkp 302 hank dkp 156 frank dkp -1 I would like to be able to click on one of the above names and have a box pop up saying "Award loot to playername", and then i hit yes / no and it announces to raid. The problem i have is getting from the buttom in the XML to the function in the lua file. the XML.... Code:
<Button name="DKPBidAuctionButtonTemplate" virtual="true"> The lua code right now is simply Code:
function DKP_Bid_Bidder_OnClick() Thanks very much !!!! |
Quote:
this:GetName() will be the name of the button that called it. Another good method is to number your controls like you did there. You have id="1" in the button, so you can do button=this:GetID() <Button name="DKPBidAuctionButton1" inherits="DKPBidAuctionButtonTemplate" id="1"/> <Button name="DKPBidAuctionButton2" inherits="DKPBidAuctionButtonTemplate" id="2"/> <Button name="DKPBidAuctionButton3" inherits="DKPBidAuctionButtonTemplate" id="3"/> <Button name="DKPBidAuctionButton4" inherits="DKPBidAuctionButtonTemplate" id="4"/> etc When they click the third button: button = this -- button == the frame DKPBidAuctionButton3 itself buttonName = this:GetName() -- button == "DKPBidAuctionButton3" buttonID = this:GetID() -- button == 3 |
lol yeah and to get the text
local buttontext = this:GetText() or simillar should work check out the XML widget API on wowwiki |
All times are GMT -6. The time now is 12:57 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI