Vertical emplacement
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Vertical emplacement
Wasn't there a property that would "center" text in a field vertically? No fiddling with margins? I think Jacque was involved...
I know I can do this sort of thing with the "formattedHeight".
Craig
I know I can do this sort of thing with the "formattedHeight".
Craig
Re: Vertical emplacement
Depending on what you are looking for, iconGravity might be the answer. But you might be asking a different question, as I don't believe this works for fields.
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Vertical emplacement
I see I have saved three methods to do this but they all do rely on margins. Here's what I've got:
I'm sorry I didn't save the authors of the other two methods.
Code: Select all
on centerLine -- calculation to get the vertical center of a line of text in a field
constant kLeft = <the left of your box>, <kRight = the right of your box>
put (item 2 of the mouseLoc - the top of fld 1) \
div the lineHeight of fld 1 into tTop
set the rect of grc "box" to kLeft,tTop,kRight,tTop+the lineHeight of fld 1
end centerLine
-----------
To center a block of text in a field, regardless of text size, variable styling, etc.:
put round(the effective textheight of me * .66) into tUnderHang
set the topmargin of me to (the height of me - (the formattedheight of line 1 to -1 of me) + tUnderHang) div 2
-------------
My forum suggestion:
on mouseUp
put the effective textheight of me * .33 into tPadding
put the formattedheight of line 1 to -1 of me into tTotalTextHt
put ( ( the height of me - tTotalTextHt ) / 2) into tTopMargin
set topmargin of me to tTopMargin + tPadding
end mouseUp
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Vertical emplacement
Jacque.
Thanks for all that. I used the formattedHeight myself to do the job. I am not sure why I thought there was something similar for vertical to the familiar "center" property for horizontal justification.
Craig
Thanks for all that. I used the formattedHeight myself to do the job. I am not sure why I thought there was something similar for vertical to the familiar "center" property for horizontal justification.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Vertical emplacement
Maybe you saw the docs for the Android native field widget. I was working with it yesterday and noticed it offers 3 different vertical placements.
Unlikely, I know.
Unlikely, I know.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Vertical emplacement
Jacque.
What is "android"? Is it some Windows outrage?
Stupid, I know.
But are these "Up", "Center" and "Down"?
Craig
What is "android"? Is it some Windows outrage?
Stupid, I know.
But are these "Up", "Center" and "Down"?
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Vertical emplacement
An Android is an intelligent robot...
The native field offers top, middle, and bottom vertical text alignment.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Vertical emplacement
Jacque.
I begrudgingly admit that the dark side has some cool stuff.
Am I the only one (again) that would love not to have to fiddle with margins and effective/formatted gadgetry to get vertical justification?
Craig
I begrudgingly admit that the dark side has some cool stuff.
Am I the only one (again) that would love not to have to fiddle with margins and effective/formatted gadgetry to get vertical justification?
Craig
Re: Vertical emplacement
Not just the dark side; FileMaker Pro has had this for decades.
However other languages/IDE, for example XOJO do not offer functionality and you have to program it in. I found myself having to do lots of things like that with XOJO which is why i ultimately left it behind for LiveCode which offers many, many conveniences - but this is one convenience that is strangely lacking...
Feature request?
However other languages/IDE, for example XOJO do not offer functionality and you have to program it in. I found myself having to do lots of things like that with XOJO which is why i ultimately left it behind for LiveCode which offers many, many conveniences - but this is one convenience that is strangely lacking...
Feature request?