New topic: 

Accurate Text Placement in Labels, TextFields and TextAreas

<http://forums.realsoftware.com/viewtopic.php?t=45898>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        JimPitchford          Post subject: Accurate Text Placement in 
Labels, TextFields and TextAreasPosted: Tue Nov 13, 2012 5:42 pm                
         
Joined: Mon Apr 11, 2011 2:01 pm
Posts: 111                My application requires me to place text quite 
accurately on screen and on the printed page but I am finding real difficulty 
in getting consistent text alignment.

Now I understand that alignment within each of the text controls will vary 
according to use of borders, focus rings, fonts and text sizes, but even 
eliminating those differences and you still end up with lots of adjustments.

Examples of problems include:

 • g.stringHeight will return a value that you can use to size the text box, 
but the amount you need to add to that to ensure all the text fits will vary 
according to font, font size and the number of lines of text and combinations 
thereof.

 • g.stringHeight also doesn't accommodate endOfLine characters in its 
calculation, so if you want space for a new line you have to trap for EndofLine 
and add the space manually.

 • textarea includes a margin down the left and righthand sides of the text, 
but I cannot find anything that specifies or allows you to change that margin.

 • The baseline of the top line of a textArea seems to vary dependent upon 
the number of lines of text included.

 • g.textAscend produces an integer that you should be able to use to align 
labels and fields against a common baseline, but this also seems to need 
different values added or taken away from each object type to get alignment.

 • I've not even started trying to get alignment using styledText, that looks 
like a nightmare!

So my question is has anyone discovered a consistent methodology by which 
horizontal and vertical text alignment can be achieved across the different 
types of text objects?

Jim      
_________________
Jim
OSX 10.8.1, rb2012r1  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to