Example:
http://imgur.com/a/39TYH#0
There is a small button with the text "A" on it. Clicking the button will toggle the achievment frame.
Button will be less visibile by default and fade in on mouseover.
The red color comes from using a Blizzard button template called "UIPanelButtonTemplate"
Code to do it:
Lua Code:
local myButton = CreateFrame("Button", "myFirstButton", UIParent, 'UIPanelButtonTemplate')
myButton:SetSize(20,20)
myButton:SetPoint("CENTER",200,0)
myButton:SetText('A')
myButton:RegisterForClicks("LeftButtonUp")
myButton:SetScript("OnClick", function() ToggleAchievementFrame() end)
myButton:SetAlpha(0.2)
myButton:SetScript("OnEnter", function(self) self:SetAlpha(1) end)
myButton:SetScript("OnLeave", function(self) self:SetAlpha(0.2) end)
http://wowprogramming.com/docs/api/CreateFrame
http://wowprogramming.com/docs/api/SetPoint
http://wowprogramming.com/docs/api/SetSize
etc.
How to create the addon for it.
Go to your WoW AddOns folder. Create a folder "myFirstButton". In that folder create a file called "myFirstButton.toc".
Put this code into the file
Lua Code:
## Interface: 40300
## Author: You
## Title: myFirstButton
## Notes: Buttons
core.lua
Now create another file called "core.lua" and copy the button code from above in that file.
Restart WoW to load the addon.