1. #1

    [Programming] Button Help

    Hey guys, noob addon coder here.

    I've looked through quite a few references and can't for the life of me seem to make a button work for me. So I've turned to you guys to hopefully point in the right direction.

    All I need is the button to hide a frame, but I'm apparently hopeless when it comes to that.

    Any help is appreciated, and the .lua file is acting as a script file if that changes anything.

    Thanks.

  2. #2
    Deleted
    Code:
    -- assumption: you've got a frame that you want to hide. it's stored in the variable myFrame.
    myFrame.close = CreateFrame("Button",nil,myFrame)
    myFrame.close:SetPoint("TOPRIGHT") -- change this to wherever you want it
    myFrame.close:SetSize(20,20) -- change to wherever you want it yet again
    myFrame.close:SetNormalTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Up") -- change to whatever
    myFrame.close:GetNormalTexture():SetTexCoord(0.25,0.75,0.25,0.75) -- the texture file actually has an empty border. we only want the actual icon.
    myFrame.close:SetScript("OnClick", function(self) self:GetParent():Hide() end)
    Or you can use a template:
    Code:
    myFrame.close = CreateFrame("Button",nil,myFrame,"UIPanelCloseButton")
    myFrame.close:SetPoint("TOPRIGHT")
    myFrame.close:SetSize(20,20)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •