Originally Posted by Game92
Thanks both will try this Xus '
Works but it doesn't overwrite the old one, and it check it in even if its not checked
LUA Code:
AftermathhUI.CheckBox = function(self) self:SetNormalTexture("") self:SetPushedTexture("") self:SetHighlightTexture("") self:SetWidth(28) self:SetHeight(28) self:SetBackdrop({ bgFile = AftermathhUI.media.backdrop, insets = {top = 4, left = 4, bottom = 4, right = 4}, }) CreateBorderLight(self, AftermathhUI.media.bordersize, AftermathhUI.bordercolor, AftermathhUI.bordercolor, AftermathhUI.bordercolor, -4) SetBorderLayer(self, "BORDER") local checkboxtexture = self:CreateTexture(nil, "OVERLAY") checkboxtexture:SetWidth(25) checkboxtexture:SetHeight(22) checkboxtexture:SetPoint("LEFT", 2, 1) checkboxtexture:SetTexture("Interface\\RAIDFRAME\\ReadyCheck-Ready") self:SetCheckedTexture(checkboxtexture) local disabledtexture = self:CreateTexture(nil, "OVERLAY") disabledtexture:SetWidth(25) disabledtexture:SetHeight(22) disabledtexture:SetPoint("LEFT", 2, 1) disabledtexture:SetTexture("Interface\\RAIDFRAME\\ReadyCheck-Ready") self:SetDisabledTexture(disabledtexture) self.disabledtexture = self:GetDisabledTexture(); self.disabledtexture:SetDesaturated(1); self.disabledtexture:SetVertexColor(0.5,0.5,0.5); self:HookScript("OnEnter", function(self) ColorBorder(self, 1.0, 0.82, 0) end) self:HookScript("OnLeave", function(self) ColorBorder(self, AftermathhUI.bordercolor, AftermathhUI.bordercolor, AftermathhUI.bordercolor) end) end
|
I probably should have mentioned that the 'texture' is the texture path, not an actually texture object
So it's easier than you think.
Edit: Actually, upon taking a closer look, I probably had the same problem you had. Because this is the full code I used to make my checkbuttons with:
Code:
local function NewCheckButton(parent)
local obj = CreateFrame("Button",nil,parent);
obj.parent = parent;
obj:SetWidth(20);
obj:SetHeight(20);
obj:SetNormalTexture("Interface\\AddOns\\Forte_Core\\Textures\\CheckButton");
obj.normaltexture = obj:GetNormalTexture();
obj.normaltexture:ClearAllPoints();
obj.normaltexture:SetWidth(16);
obj.normaltexture:SetHeight(16);
obj.normaltexture:SetPoint("CENTER",obj,"CENTER",0,0);
obj:SetDisabledTexture("Interface\\AddOns\\Forte_Core\\Textures\\CheckButton");
obj.disabledtexture = obj:GetDisabledTexture();
obj.disabledtexture:ClearAllPoints();
obj.disabledtexture:SetWidth(16);
obj.disabledtexture:SetHeight(16);
obj.disabledtexture:SetPoint("CENTER",obj,"CENTER",0,0);
obj.disabledtexture:SetVertexColor(0.5,0.5,0.5);
--obj.disabledtexture:SetDesaturated(1);
obj.background = obj:CreateTexture(nil,"BACKGROUND");
obj.background:SetTexture(0,0,0,0.2);
obj.background:SetWidth(10);
obj.background:SetHeight(10);
obj.background:SetPoint("CENTER",obj,"CENTER",0,0);
obj.texture = obj:CreateTexture(nil,"OVERLAY");
obj.texture:SetTexture("Interface\\Buttons\\UI-CheckBox-Check");
obj.texture:SetAllPoints(obj);
obj.title = "[click to toggle]";
obj.tip = "";
obj.SetEnabled = function(self,enabled)
if enabled then
obj.texture:SetDesaturated(false);
self:Enable();
else
self:Disable();
obj.texture:SetDesaturated(true);
end
end
obj.SetChecked = function(self,checked)
if checked then
obj.texture:SetVertexColor(1,1,1,1);
else
obj.texture:SetVertexColor(1,1,1,0);
end
end
obj:SetScript("OnEnter",function(self)
obj.background:SetTexture(1,1,1,0.05);
FW:ShowOptionsTip(self);
end);
obj:SetScript("OnLeave",function(self)
FW:HideTip(self);
obj.background:SetTexture(0,0,0,0.1);
end);
return obj;
end
You should be able to figure something out with that!
I'm just not sure if it's worth it when you can just replace the texture for your whole interface by adding a replacement in your interface folder.