Thread Tools Display Modes
05-31-06, 01:34 AM   #1
Laurent
A Deviate Faerie Dragon
 
Laurent's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 12
Make Blizz stuff movable/lockable

Hello I'm looking for someone to help me finish my mod I'm making. I'm trying to do 3 things atm: first I want to be able to click and drag the menu bar, the actionbar, the bag bar, the right action bar and the pet bar. Also I want to be able to lock those elements in place after and save their positions in a saved variables file. I have minimal programming and skills and I was doing good until I hit this snag.This is overwhelming me even after looking at countless other mods coding. If anyone can help me out as a "tutor" I'd be very grateful. You can add me to you MSN if you want: [email protected] or contact me on Nathrezim: Fedris or Sikorsky and there is always this forum and email! Thanks in advance.

PS. If this si sloppy forgive me as it is 1:30 in the morning and i have been analyzing code for almost 2 hours. Hehe.
  Reply With Quote
05-31-06, 03:33 AM   #2
Zyonin
Coffee powered Kaldorei
 
Zyonin's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 1,443
I can't help you on coding a mod, however I can point you to mods that do what you want already.

First up: Discord Action Bars http://www.wowinterface.com/download...tion_Bars.html
DAB is a very flexible replacement for the action bars (pet, menu, hotbars (also know as action bars), bag bar, etc). You get up to 10 action bars to play with. You can rotate, hide, change the art, hide the art, repostion wherever your please, lock the buttons onto each bar, lock the bar positions, and change the layout of the bars. In addition you can save the layout in a SaveVariables.lua file, and also download Custom Layouts from the Discord Mods website http://www.discordmods.com. On the Discord Mods site there is a downloadable utility to extract your layouts as a CustomLayout.lua file so you can share your layout with other DAB users.

Next up is Bongos http://www.wowinterface.com/download...44-Bongos.html
Bongos can do many of the things that DAB can do, however it is not as scalable as DAB nor do you have the option of changing the bar art. The mod does hide the default Blizzard bar art (the grifffons on either side).

Another one is Gypsy Hotbar Mod http://www.wowinterface.com/download...od_HotBar.html
Not as fliexbible as either DAB or Bongos, however you can postion all the bars where you please, rotate the bars, and lock em into place. Gypsy is also rock solid stable.

There other bar mods out there that do what you are looking to do. The ulitmate and least newbie friendly is Flexbar http://www.wowinterface.com/download...4-Flexbar.html

Last edited by Zyonin : 05-31-06 at 03:43 AM.
  Reply With Quote
05-31-06, 08:19 AM   #3
Laurent
A Deviate Faerie Dragon
 
Laurent's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 12
I appreciate your reply and I am aware of those mods already. I am in the process of learning Lua and I am making my own mod as I go. Now as one point my mod is CleanBar (http://ui.worldofwar.net/ui.php?id=2418) and it is pretty basic not too much of a mod. Benzo took my mod and made it better but I still want to learn on my own. So far I have taken my original CleanBar mod and added horizontal and verticlal options for the mehu and bags. I've leanrt how to make my code cleaner and simple stuff like that, but this "Make Movable" and "Lock" functions elude me and that's why I would like help. Also my mod I am making is different than those you listed, they sacrifice memory for additional functionality. My mod I am creating is basically the original Blizzard elements made moveable and options to make them vertical or not, nothing overly memory consuming.

PS. Flexbar is the coolest. (sorry Loz)
  Reply With Quote
06-09-06, 06:57 AM   #4
Dhargo
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 32
Hiya - I just wrote a couple of short bar mods (more as proof of concept than anything) and posted the code in the UI forums at blizz. That server is down right now (naturally) but I'll post the code here.

The first is one I call BarsLite - all it does is turns the 5 Blizzard bars into independently movable bars that can be dragged around and have their width changed.

Next post is that code. Note - I wrote this to prove that all the new toys Slouken has given us makes this stuff very easy compared to when I wrote FlexBar, it's not well commented, but I can answer any questions you have.

Also - FlexLite handles BonusActionButtons (they replace standard ones for druids/warriors/rogues) BarsLite just ignores them.
  Reply With Quote
06-09-06, 06:59 AM   #5
Dhargo
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 32
BarsLite.lua

Code:
BarsLite = {}
local bars={"Action","MultiBarRight","MultiBarLeft","MultiBarBottomLeft","MultiBarBottomRight"}
BarsLite_Saved_Data = {}
for i,v in ipairs(bars) do BarsLite_Saved_Data[v]={} end
local profile = nil

function BarsLite.ApplySize(bar,num)
	local w = profile[bar].w or 12
	local s = profile[bar].s or 0
	for i = 2,12 do
		local button = getglobal(bar.."Button"..i)
		button:ClearAllPoints()
		if math.mod(i-1,w) == 0 then
			button:SetPoint("TOP",bar.."Button"..(i-w),"BOTTOM",0,-s)
		else
			button:SetPoint("LEFT",bar.."Button"..(i-1),"RIGHT",s,0)
		end
	end
end

function BarsLite.ApplyLoc(bar,num)
	local x = profile[bar].x or 400
	local y = profile[bar].y or (num * 50)+400
	local frame = getglobal(bar)
	local btn = getglobal(bar.."Button1")
	frame:ClearAllPoints()
	frame:SetPoint("BOTTOMLEFT",UIParent,"BOTTOMLEFT",x,y)
	btn:ClearAllPoints()
	btn:SetPoint("TOPLEFT",frame,"BOTTOMLEFT",0,0)
end

function BarsLite.DragStart()
	this:GetParent():StartMoving()
end

function BarsLite.DragStop()
	this:GetParent():StopMovingOrSizing()
	profile[bars[this:GetID()]].x = this:GetParent():GetLeft()
	profile[bars[this:GetID()]].y = this:GetParent():GetBottom()
end

function BarsLite.Click()
	
	if arg1 == "LeftButton" then
		if not profile[bars[this:GetID()]].w then profile[bars[this:GetID()]].w = 12 end
		profile[bars[this:GetID()]].w = profile[bars[this:GetID()]].w + 1
		if profile[bars[this:GetID()]].w > 12 then profile[bars[this:GetID()]].w = 1 end
	else
		if not profile[bars[this:GetID()]].s then profile[bars[this:GetID()]].s = 0 end
		profile[bars[this:GetID()]].s = profile[bars[this:GetID()]].s + 1
		if profile[bars[this:GetID()]].s > 10 then profile[bars[this:GetID()]].s = 0 end
	end
	BarsLite.ApplySize(bars[this:GetID()],this:GetID())
end

local f = CreateFrame("Frame","Action",UIParent)
f:RegisterEvent("VARIABLES_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent",function()
	if event == "VARIABLES_LOADED" then
		profile = BarsLite_Saved_Data
	elseif event == "PLAYER_LOGIN" then
		for i,v in ipairs(bars) do
			BarsLite.ApplyLoc(v,i)
			BarsLite.ApplySize(v,i)
		end
	end
end)

for i,v in ipairs(bars) do
	local frame = getglobal(v)
	frame:SetHeight(15)
	frame:SetWidth(15)
	frame:SetMovable(1)
	local btn = CreateFrame("Button",v.."Control",frame)
	btn:SetAllPoints(frame)
	btn:RegisterForDrag("LeftButton")
	btn:RegisterForClicks("LeftButtonUp","RightButtonUp")
	btn:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", 
					edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 
					tile = true, tileSize = 8, edgeSize = 8, 
					insets = { left = 0, right = 0, top = 0, bottom = 0 }})
	btn:SetScript("OnDragStart",BarsLite.DragStart)
	btn:SetScript("OnDragStop",BarsLite.DragStop)
	btn:SetScript("OnClick",BarsLite.Click)
	btn:Hide()
	btn:SetID(i)
end
		 
SlashCmdList["BarsLiteCOMMAND"] = 
function(msg) 
	for i,v in ipairs(bars) do
		local btn = getglobal(v.."Control")
		if btn:IsVisible() then
			btn:Hide()
		else
			btn:Show()
		end
	end
end

SLASH_BarsLiteCOMMAND1 = "/bl"
SLASH_BarsLiteCOMMAND2 = "/barslite"
BarsLite.toc

Code:
## Interface: 11000
## Title: BarsLite
## Notes: Makes the Blizzard bars movable and resizable
## SavedVariablesPerCharacter:: BarsLite_Saved_Data
BarsLite.lua
  Reply With Quote
06-09-06, 07:01 AM   #6
Dhargo
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 32
FlexLite.lua

Code:
FlexLite = {}
MainMenuBar:Hide()

local bars={"MultiBarRightButton","MultiBarLeftButton","MultiBarBottomLeftButton","MultiBarBottomRightButton","ActionButton","ShapeshiftButton","Bags","Mini"}
local apts={"TOPLEFT","TOP","TOPRIGHT","RIGHT","BOTTOMRIGHT","BOTTOM","BOTTOMLEFT","LEFT","TOPLEFT","TOP","TOPRIGHT","RIGHT"}
local vals={{1,-1},{0,-1},{-1,-1},{-1,0},{-1,1},{0,1},{1,1},{1,0}}
local backdrop = {	bgFile = "Interface/Tooltips/UI-Tooltip-Background", 
					edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 
					tile = true, tileSize = 8, edgeSize = 8, 
					insets = { left = 0, right = 0, top = 0, bottom = 0 }}

					local EDITING,NUM_BUTTONS,profile,docking,btns,dbtns,dockto,nudging,sel = nil,83,nil,nil,{},{},nil,nil,{}
sel.n = 0

FlexLite_Saved_Data = {}
for i = 1,NUM_BUTTONS do FlexLite_Saved_Data[i]={} end

function FlexLite.ApplySettings(num)
	local x = profile[num].x or math.floor(200+(math.mod(num-1,12)*40))
	local y = profile[num].y or math.floor(200+(math.floor((num-1)/12)*40))
	btns[num]:SetAlpha(profile[num].alpha or 1)
	btns[num]:SetScale(profile[num].scale or 1)
	x = x * 1/btns[num]:GetEffectiveScale()
	y = y * 1/btns[num]:GetEffectiveScale()
	if not profile[num].hidden then 
		btns[num]:Show() 
		getglobal(btns[num]:GetName().."Control"):SetBackdropColor(0,1,0)
	else 
		btns[num]:Hide() 
		getglobal(btns[num]:GetName().."Control"):SetBackdropColor(1,0,0)
	end
	btns[num]:ClearAllPoints()
	if not profile[num].dock then
		btns[num]:SetPoint("BOTTOMLEFT",UIParent,"BOTTOMLEFT",x,y)
	else
		btns[num]:SetPoint(apts[profile[num].dock.point],btns[profile[num].dock.relativepoint],apts[profile[num].dock.point+4],x,y)
	end
end

function FlexLite.DragStart()
	profile[this:GetID()].dock = nil
	this:GetParent():StartMoving()
end

function FlexLite.DragStop()
	this:GetParent():StopMovingOrSizing()
	profile[this:GetID()].x = this:GetParent():GetLeft()
	profile[this:GetID()].y = this:GetParent():GetBottom()
	FlexLite.ApplySettings(this:GetID())
end

function FlexLite.Click()
	if docking then
		if arg1=="RightButton" then
			docking = nil
			dockto = nil
			for i=1,8 do dbtns[i]:Hide() end
		else	
			dockto = this:GetID()
			FlexLite.Dock(this:GetID(),nil)
		end
		return
	end
	local found = nil
	for i,v in ipairs(sel) do
		if this:GetID() == v then
			found = i
			break
		end
	end
	
	if found then
		FlexLite.ResetColor(this:GetID())
		table.remove(sel,found)
	else
		table.insert(sel,this:GetID())
		this:SetBackdropColor(1,1,0)
	end
end

function FlexLite.Hide()
	for i,v in ipairs(sel) do
		profile[v].hidden = true
	end
	for i,v in ipairs(sel) do getglobal(btns[v]:GetName().."Control"):SetBackdropColor(1,1,0) end
end

function FlexLite.Show()
	for i,v in ipairs(sel) do
		profile[v].hidden = nil
	end
	for i,v in ipairs(sel) do getglobal(btns[v]:GetName().."Control"):SetBackdropColor(1,1,0) end
end

function FlexLite.Scale(val)
	for i,v in ipairs(sel) do
		profile[v].scale = profile[v].scale or 1
		profile[v].scale = profile[v].scale + val
		if profile[v].scale > 2 then profile[v].scale = .5 end
		if profile[v].scale < .5 then profile[v].scale = 2 end
		FlexLite.ApplySettings(v)
	end
	for i,v in ipairs(sel) do getglobal(btns[v]:GetName().."Control"):SetBackdropColor(1,1,0) end
end

function FlexLite.Alpha(val)
	for i,v in ipairs(sel) do
		profile[v].alpha = profile[v].alpha or 1
		profile[v].alpha = profile[v].alpha + val
		if profile[v].alpha > 1 then profile[v].alpha = .1 end
		if profile[v].alpha < .1 then profile[v].alpha = 1 end
		FlexLite.ApplySettings(v)
	end
	for i,v in ipairs(sel) do getglobal(btns[v]:GetName().."Control"):SetBackdropColor(1,1,0) end
end

function FlexLite.Nudge(val,dir)
	for i,v in ipairs(sel) do
		profile[v].x = profile[v].x or btns[v]:GetLeft()
		profile[v].y = profile[v].y or btns[v]:GetBottom()
		profile[v].x = profile[v].x + val*vals[dir][1]
		profile[v].y = profile[v].y + val*vals[dir][2]
		FlexLite.ApplySettings(v)
	end
	for i,v in ipairs(sel) do getglobal(btns[v]:GetName().."Control"):SetBackdropColor(1,1,0) end
end

function FlexLite.Dock(dockframe,pt)
	if pt then
		for i,v in ipairs(sel) do
			profile[v].dock = {}
			profile[v].dock.relativepoint = dockframe
			profile[v].dock.point = pt
			profile[v].x = 0
			profile[v].y = 0
			dockframe = v
			FlexLite.ApplySettings(v)
		end
		for i,v in ipairs(sel) do getglobal(btns[v]:GetName().."Control"):SetBackdropColor(1,1,0) end
		for i=1,8 do dbtns[i]:Hide() end
		docking,dockto = nil
	elseif dockframe then
		for i=1,8 do
			dbtns[i]:ClearAllPoints();dbtns[i]:SetPoint(apts[i],btns[dockto],apts[i+4],0,0)
			dbtns[i]:Show()
		end
	else
		docking = true
	end
end

function FlexLite.ClearSel()
	while sel.n > 0 do
		FlexLite.ResetColor(sel[sel.n])
		table.remove(sel)
	end
	sku.prn(sel.n)
end

function FlexLite.ResetColor(num)
	if profile[num].hidden then
		getglobal(btns[num]:GetName().."Control"):SetBackdropColor(1,0,0)
	else 
		getglobal(btns[num]:GetName().."Control"):SetBackdropColor(0,1,0)
	end
end
  Reply With Quote
06-09-06, 07:02 AM   #7
Dhargo
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 32
Bah - 2nd half of FlexLite (the forum didn't like how long it was. Just 300 lines, but over the character limit)

Code:
local f = CreateFrame("Frame","FlexLiteFrame",UIParent)
f:RegisterEvent("VARIABLES_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent",function()
	if event == "VARIABLES_LOADED" then
		profile = FlexLite_Saved_Data
	elseif event == "PLAYER_LOGIN" then
		for i=1,NUM_BUTTONS do
			FlexLite.ApplySettings(i)
		end
	end
end)
f:SetHeight(160)
f:SetWidth(125)
f:SetBackdrop(backdrop)
f:SetBackdropColor(.2,.2,.2)
f:SetPoint("RIGHT",-20,0)
f:Hide()
f:SetMovable(1)
f:EnableMouse(1)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart",function() this:StartMoving() end)
f:SetScript("OnDragStop",function() this:StopMovingOrSizing() end)

local labels = {"Hide","Show","ScaleUp","ScaleDn","AlphaUp","AlphaDn","Dock","UP","LF","RT","DN","Clear","RESET"}
local offsets= {{5,-5},{65,-5},{5,-24},{65,-24},{5,-43},{65,-43},{35,-62},{35,-81},{5,-100},{65,-100},{35,-119},{5,-138},{65,-138}}
for i,v in labels do
	local btn = CreateFrame("Button","FlexLite"..v.."Btn",f)
	btn:SetPoint("TOPLEFT",f,"TOPLEFT",offsets[i][1],offsets[i][2])
	btn:SetHeight(17);btn:SetWidth(55)
	btn:SetBackdrop(backdrop)
	btn:SetBackdropColor(0,.7,.7)
	btn:RegisterForClicks("LeftButtonUp","RightButtonUp")
	fnt = btn:CreateFontString("FlexLite"..v.."LBL")
	fnt:SetFont("Fonts\\FRIZQT__.TTF",12)
	fnt:SetHeight(15)
	fnt:SetWidth(50)
	fnt:SetPoint("CENTER",0,0)
	fnt:SetJustifyH("CENTER")
	fnt:SetText(v)
end

FlexLiteHideBtn:SetScript("OnClick",function() FlexLite.Hide() end)
FlexLiteShowBtn:SetScript("OnClick",function() FlexLite.Show() end)
FlexLiteScaleUpBtn:SetScript("OnClick",function() FlexLite.Scale(.05) end)
FlexLiteScaleDnBtn:SetScript("OnClick",function() FlexLite.Scale(-.05) end)
FlexLiteAlphaUpBtn:SetScript("OnClick",function() FlexLite.Alpha(.05) end)
FlexLiteAlphaDnBtn:SetScript("OnClick",function() FlexLite.Alpha(-.05) end)
FlexLiteDockBtn:SetScript("OnClick",function() FlexLite.Dock() end)
FlexLiteUPBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,6) else FlexLite.Nudge(10,6) end end)
FlexLiteLFBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,4) else FlexLite.Nudge(10,4) end end)
FlexLiteRTBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,8) else FlexLite.Nudge(10,8) end end)
FlexLiteDNBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,2) else FlexLite.Nudge(10,2) end end)
FlexLiteClearBtn:SetScript("OnClick",function() FlexLite.ClearSel() end)
FlexLiteRESETBtn:SetScript("OnClick",function() for i,v in ipairs(sel) do profile[v]={} FlexLite.ApplySettings(v) end FlexLite.ClearSel() end)

for i = 1,8 do
	local btn = CreateFrame("Button")
	btn:SetHeight(15);btn:SetWidth(15);btn:SetBackdrop(backdrop);btn:SetID(i)
	btn:RegisterForClicks("LeftButtonUp")
	btn:SetScript("OnClick",function() FlexLite.Dock(dockto,this:GetID()) end)
	btn:Hide()
	dbtns[i] = btn
end

btns.n=0
local bags = {"MainMenuBarBackpackButton","CharacterBag0Slot","CharacterBag1Slot","CharacterBag2Slot","CharacterBag3Slot"}
local mini = {"CharacterMicroButton","SpellbookMicroButton","TalentMicroButton","QuestLogMicroButton","SocialsMicroButton","WorldMapMicroButton","MainMenuMicroButton","HelpMicroButton"}
for i,v in ipairs(bars) do
	for j=1,12 do
		local pre = ""
		if i == 5 and UnitClass("player") == "Warrior" or UnitClass("player") == "Druid" or UnitClass("player") == "Rogue" then pre="Bonus" end
		local button = getglobal(pre..v..j)
		if v == "Bags" then
			button = getglobal(bags[j])
		end
		if v == "Mini" then
			button = getglobal(mini[j])
		end
		if not button then break end
		button:SetMovable(1)
		if i == 6 then button.isShapeshift = true end
		if i >= 5 then button:SetParent(UIParent) end
		table.insert(btns,button)
		local btn = CreateFrame("Button",button:GetName().."Control",button)
		btn:SetAllPoints(button)
		btn:SetFrameLevel(btn:GetFrameLevel()+50)
--		btn:SetAlpha(.75)
		btn:RegisterForDrag("LeftButton")
		btn:RegisterForClicks("LeftButtonUp","RightButtonUp")
		btn:SetBackdrop(backdrop)
		btn:SetScript("OnDragStart",FlexLite.DragStart)
		btn:SetScript("OnDragStop",FlexLite.DragStop)
		btn:SetScript("OnClick",FlexLite.Click)
		btn:Hide()
		btn:SetID(btns.n)
		local show = button:GetScript("OnShow") or function() end
		button:SetScript("OnShow",function() 
			show() 
			local ctl = getglobal(this:GetName().."Control")
			if 	(not EDITING) and ((ctl and profile[ctl:GetID()].hidden) or 
				(this.isBonus and GetBonusBarOffset() < 1) or
				(this.isShapeshift and not ShapeshiftBarFrame:IsVisible())) then
				this:Hide()
			end
		end)
	end
end

local show = BonusActionBarFrame:GetScript("OnShow") or function() end
local hide = BonusActionBarFrame:GetScript("OnHide") or function() end
BonusActionBarFrame:SetScript("OnShow",
function() 
	show() 
	for i=61,72 do 
		if HasAction(ActionButton_GetPagedID(btns[i])) and not profile[i].hidden then
			btns[i]:Show() 
		else
			btns[i]:Hide()
		end
	end 
end)
BonusActionBarFrame:SetScript("OnHide",function() hide() for i=61,72 do btns[i]:Hide() end end)
	
SlashCmdList["FlexLiteCOMMAND"] = 
function(msg) 
	if string.lower(msg or "") == "reset" then
		for i=1,NUM_BUTTONS do
			profile[i]={}
			FlexLite.ApplySettings(i)
		end
		return
	end
	EDITING = not EDITING
	if EDITING then f:Show() else f:Hide() end
	for i=1,NUM_BUTTONS do
		if EDITING then
			btns[i]:Show()
			getglobal(btns[i]:GetName().."Control"):Show()
		else
			getglobal(btns[i]:GetName().."Control"):Hide()
			FlexLite.ApplySettings(i)
			nudging,docking,dockto = nil,nil,nil
			for i = 1,8 do dbtns[i]:Hide() end
			if btns[i].isBonus and GetBonusBarOffset() < 1 then btns[i]:Hide() end
		end
	end
end

SLASH_FlexLiteCOMMAND1 = "/fl"
SLASH_FlexLiteCOMMAND2 = "/FlexLite"
FlexLite.toc

Code:
## Interface: 11000
## Title: FlexLite
## Notes: Makes the Blizzard buttons FlexButtons
## SavedVariablesPerCharacter: FlexLite_Saved_Data
FlexLite.lua
  Reply With Quote
06-09-06, 07:06 AM   #8
Dhargo
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 32
One thing to note is that, unlike the original FlexBar these are completely GUI driven. The new lua created frames from 1.10 made this much easier for me. I always found creating and editing XML to be a tedious and error prone way to create GUI elements.

As you'll note in FlexLite - I create around 100 widgets in the space of 100 lines of lua code.

This in particular:

Code:
local f = CreateFrame("Frame","FlexLiteFrame",UIParent)
f:RegisterEvent("VARIABLES_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent",function()
	if event == "VARIABLES_LOADED" then
		profile = FlexLite_Saved_Data
	elseif event == "PLAYER_LOGIN" then
		for i=1,NUM_BUTTONS do
			FlexLite.ApplySettings(i)
		end
	end
end)
f:SetHeight(160)
f:SetWidth(125)
f:SetBackdrop(backdrop)
f:SetBackdropColor(.2,.2,.2)
f:SetPoint("RIGHT",-20,0)
f:Hide()
f:SetMovable(1)
f:EnableMouse(1)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart",function() this:StartMoving() end)
f:SetScript("OnDragStop",function() this:StopMovingOrSizing() end)

local labels = {"Hide","Show","ScaleUp","ScaleDn","AlphaUp","AlphaDn","Dock","UP","LF","RT","DN","Clear","RESET"}
local offsets= {{5,-5},{65,-5},{5,-24},{65,-24},{5,-43},{65,-43},{35,-62},{35,-81},{5,-100},{65,-100},{35,-119},{5,-138},{65,-138}}
for i,v in labels do
	local btn = CreateFrame("Button","FlexLite"..v.."Btn",f)
	btn:SetPoint("TOPLEFT",f,"TOPLEFT",offsets[i][1],offsets[i][2])
	btn:SetHeight(17);btn:SetWidth(55)
	btn:SetBackdrop(backdrop)
	btn:SetBackdropColor(0,.7,.7)
	btn:RegisterForClicks("LeftButtonUp","RightButtonUp")
	fnt = btn:CreateFontString("FlexLite"..v.."LBL")
	fnt:SetFont("Fonts\\FRIZQT__.TTF",12)
	fnt:SetHeight(15)
	fnt:SetWidth(50)
	fnt:SetPoint("CENTER",0,0)
	fnt:SetJustifyH("CENTER")
	fnt:SetText(v)
end

FlexLiteHideBtn:SetScript("OnClick",function() FlexLite.Hide() end)
FlexLiteShowBtn:SetScript("OnClick",function() FlexLite.Show() end)
FlexLiteScaleUpBtn:SetScript("OnClick",function() FlexLite.Scale(.05) end)
FlexLiteScaleDnBtn:SetScript("OnClick",function() FlexLite.Scale(-.05) end)
FlexLiteAlphaUpBtn:SetScript("OnClick",function() FlexLite.Alpha(.05) end)
FlexLiteAlphaDnBtn:SetScript("OnClick",function() FlexLite.Alpha(-.05) end)
FlexLiteDockBtn:SetScript("OnClick",function() FlexLite.Dock() end)
FlexLiteUPBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,6) else FlexLite.Nudge(10,6) end end)
FlexLiteLFBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,4) else FlexLite.Nudge(10,4) end end)
FlexLiteRTBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,8) else FlexLite.Nudge(10,8) end end)
FlexLiteDNBtn:SetScript("OnClick",function() if arg1=="LeftButton" then FlexLite.Nudge(1,2) else FlexLite.Nudge(10,2) end end)
FlexLiteClearBtn:SetScript("OnClick",function() FlexLite.ClearSel() end)
FlexLiteRESETBtn:SetScript("OnClick",function() for i,v in ipairs(sel) do profile[v]={} FlexLite.ApplySettings(v) end FlexLite.ClearSel() end)
is just 54 lines of code and it defines a nice little GUI panel that allows you to apply changes to the selected buttons.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Make Blizz stuff movable/lockable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off