New topic: Linespace
<http://forums.realsoftware.com/viewtopic.php?t=47113> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message lenpartico Post subject: LinespacePosted: Thu Feb 28, 2013 7:26 pm Joined: Fri Sep 30, 2005 10:49 pm Posts: 494 Hello, I am trying to adjust the height of a TextField as follows... myTextfield has LockTop and Lockbottom checked. myTextfield is in myWindow myWindow.Height = myOriginalWindowHeight + myTextfieldNumberOflines*myTextfield.Textsize myTextfieldNumberOflines*myTextfield.Textsize is 12 but to get the correct value for myWindow.Height I have to use 15 instead of 12 What is the space between lines? Is it a fixed value or a percentage of Textsize? Thanks. Lennox Top harriew Post subject: Re: LinespacePosted: Thu Feb 28, 2013 8:12 pm Joined: Fri Dec 01, 2006 3:09 pm Posts: 633 Location: Tennessee, USA You need to do some extra calculations in order to get the proper height of a line. Something like the following: Dim g As Graphics Dim p As Picture Dim lnHeight As Integer p = New Picture(1, 1, 32) // g = p.graphics g.TextFont = myTextField.TextFont g.TextSixe = myTextField.TextSize lnHeight = g.TextHeight Now lnHeight will have the proper height of a line that used that font and textsize. If you have bold, underline, or italics set for that TextField then you should also set the proper values for g.bold, g.underline and g.italic. This lnHeight value is the same that you would increment Y when printing down a page to go from one line to the next when printing line by line. You can look at the Graphics class in the LR to see the various properties. Top lenpartico Post subject: Re: LinespacePosted: Thu Feb 28, 2013 8:49 pm Joined: Fri Sep 30, 2005 10:49 pm Posts: 494 Thanks Harrie, Lennox Top lenpartico Post subject: Re: LinespacePosted: Thu Feb 28, 2013 9:11 pm Joined: Fri Sep 30, 2005 10:49 pm Posts: 494 I don't understand why, but lnHeight = g.TextHeight-1 works better than lnHeight = g.TextHeight I am using Lucida Grande with TextSize 12 Lennox Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- 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]
