View Single Post
08-30-13, 10:11 PM   #1
Lazare
An Aku'mai Servant
 
Lazare's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 36
Using LUA but having problems with making a button...

that does not use UIPanelButtonTemplate for a background. Would love to have a button that is just the text itself or an icon or "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6:14:14|t" as an example.
I just like clean interfaces and believe that having just the raid icon itself against the background of the frame would be great. I could probably do it in XML but Phanx pointed out everything should be done in Lua, so I shifted my whole project to that Lei ShenCoordinator 2.
The buttons that I currently have use the following code:
Lua Code:
  1. local function CreateBasicButton(parent, name, text, tooltipText)
  2.     local button = CF("Button", name, parent, "SecureActionButtonTemplate, UIPanelButtonTemplate")
  3.     button.text = _G[button:GetName().."Text"]
  4.     button.text:SetText(text)
  5.     button:SetWidth(30)
  6.     button:SetHeight(30)
  7.     button:SetScript("OnEnter", function(self)
  8.       GameTooltip:SetOwner(self, "ANCHOR_TOP")
  9.       GameTooltip:AddLine(tooltipText, 0, 1, 0.5, 1, 1, 1)
  10.       GameTooltip:Show()
  11.     end)
  12.     button:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
  13.     return button
  14.   end
  15.  
  16.   --create world marker buttons
  17. local button = CreateBasicButton(LeiShenCoordinator, "Button", "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6:14:14|t", "Raid Marker 1\nRight-click to clear")
  18.     button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
  19.     button:SetAttribute("type", "macro")
  20.     button:SetAttribute("macrotext", format("/wm 1"))
  21.     --if not previousButton then
  22.       button:SetPoint("TOPRIGHT", LeiShenCoordinator, -120, -80)
  23.       button:SetAttribute("type2", "macro")
  24.     button:SetAttribute("macrotext2", format("/cwm 1"))

Thanks in advance!
  Reply With Quote