Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-13-19, 02:10 AM   #1
MooreaTv
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 38
supernoob questions about strings and font in editbox

Hi there,

I'm trying to do 2 things and banging my head against the wall:

a) I'd like put a fixed font in a (static dialog) editBox
I found in Fonts.xml a handful of huge fonts like System_world and in FontStyles.xml it's referenced as CombatText

If I e:SetFontObject(CombatTextFont) it is huge
How can I set a smaller version of the same font (I don't want to ship custom fonts with my addon, just use any non proportional font)

b) I would like to change the width of the box (and the height too if I change the font), I found
e:SetWidth(width)
and also that I am supposed to use :GetStringWidth() on a FontString but I can't seem to extract/find the fontstring that must be somewhere inside the EditBox :-(
(for height it'll be editBox:SetHeight() once I find where to call :GetStringHeight())


I feel I'm very close yet so far... halp! please !

thanks!

edit: solved below. also forgot to give some context on why I want a) and b): it's for something that the user need to copy from the game and happens to have a maximum character length (thus there is no resizing needed once the right size is found)

ps: the code I am trying to make work is https://github.com/mooreatv/DynamicB...I.lua#L85-L103

Last edited by MooreaTv : 06-13-19 at 10:40 PM. Reason: adding link to source code; fixed line numbers; update
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » supernoob questions about strings and font in editbox


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