View Single Post
10-20-05, 04:15 PM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 522
function DKP_Bid_Bidder_OnClick()
DEFAULT_CHAT_FRAME:AddMessage("wtf do i put here to get the name or text of what i click on!!!!");
end
When this is called, the global variable "this" is the frame that called it.

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
  Reply With Quote