Thread Tools Display Modes
03-31-09, 06:26 PM   #1
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
EditBox font overlap

Code:
local e = CreateFrame("EditBox", "CFM_HeightBox", CFM_Config)
    e:SetWidth(45)
    e:SetHeight(18)
    e:SetPoint("TOPRIGHT", CFM_Config, "TOPRIGHT", -5,-25)
    e:SetBackdrop({
        bgFile="",
        edgeFile="Interface\\Tooltips\\UI-Tooltip-Border",
        tile="true",
        tileSize= 32,
        edgeSize=10,
        insets = {left=5, right=5, top=5, bottom=5}
    })
    e:SetAutoFocus(false)
    e:SetFontObject("GameFontNormal") 
    e:SetMaxLetters(4)
    e:SetText("9999")
    e:RegisterEvent("OnEscapePressed")
    e:RegisterEvent("OnEnterPressed")
    e:SetScript("OnEnterPressed", function(self) self:ClearFocus() end)
    e:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)


EditBox appears and functions fine except the text is overlapping the left edge. Looking through the wiki and not seeing any indent settings so wondering how I can fix this.
  Reply With Quote
04-01-09, 04:23 AM   #2
Aezay
A Theradrim Guardian
 
Aezay's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 66
Looking at the ChatFrameEditBoxTemplate in the ChatFrame.xml file, it sets the normal borders not with its backdrop, but with a left, center and right texture using "Interface\ChatFrame\UI-ChatInputBorder-Left".

The FontString is the first region of the editbox type though, you can use this code to move it around.

Code:
local fontString = editBox:GetRegions();
fontString:ClearAllPoints();
fontString:SetPoint("LEFT",10,0)
  Reply With Quote
04-01-09, 08:22 AM   #3
IBLJerry
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 12
Originally Posted by ChaosInc View Post
EditBox appears and functions fine except the text is overlapping the left edge. Looking through the wiki and not seeing any indent settings so wondering how I can fix this.
Not described in wowwiki, but:
Code:
EditBox:SetTextInsets(leftOffset, rightOffset, topOffset, bottomOffset)
Is the function you're looking for.
  Reply With Quote
04-01-09, 09:41 AM   #4
Aezay
A Theradrim Guardian
 
Aezay's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 66
IBLJerry
Thanks, didn't knew about that one, and I actually have a nice use for it in one of my addons
  Reply With Quote
04-04-09, 02:06 PM   #5
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by IBLJerry View Post
Not described in wowwiki, but:
Code:
EditBox:SetTextInsets(leftOffset, rightOffset, topOffset, bottomOffset)
Is the function you're looking for.
Awesome mate. Thx a bunch.
  Reply With Quote
04-08-09, 09:52 AM   #6
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 97
Originally Posted by ChaosInc View Post
Code:
    e:RegisterEvent("OnEscapePressed")
    e:RegisterEvent("OnEnterPressed")
    e:SetScript("OnEnterPressed", function(self) self:ClearFocus() end)
    e:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
There is no need to register events because they aren't events but widgets handlers. If they were events you should have SetScript("OnEvent", function()...) .

This code should work
Code:
    e:SetScript("OnEnterPressed",  e.ClearFocus)
    e:SetScript("OnEscapePressed", e.ClearFocus)
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » EditBox font overlap


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