View Single Post
03/29/15, 06:37 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Well its kind of hard to say without knowing exactly what your doing & what all controls are involved, but this will give you a start & some ideas. Do keep in mind if there are other controls involved or anchored to/around these controls it could cause other problems changing the sizes of these controls.
Lua Code:
  1. -- labelControl -- the control that holds the clock text 12:00
  2.  
  3. local textWidth = labelControl:GetTextWidth()
  4. labelControl:SetWidth(textWidth+somePadding)
I put + somePadding, which may not be necessary...again to many unknown factors, but for example in a clock that I wrote due to the font & size I choose for my clock the TextWidth alone was not large enough and the text touched the clock border. You may or may not need padding.

Do note, there are several unknown factors here. For example if the lableControl is inside of other controls, resizing the labelControl alone would not (probably not) solve the problem. Because its parent or top level control would still remain the same size...and so anything anchored to its parent or top level control would still "appear" to be farther away or closer (look like the gaps size is changing).

I could make a better suggestion if you post some of the code for the controls your talking about so i can see how they are laid out.
  Reply With Quote