Vertical center alignment of data grid row

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AppleBite
Posts: 7
Joined: Fri Oct 31, 2014 10:25 am

Vertical center alignment of data grid row

Post by AppleBite » Fri Oct 31, 2014 10:31 am

I'm new to Livecode and can't find a solution for my problem:

I have 2 columns in a datagrid. First column is a normal text column, second is filled with an image and a fixed height.

Now the text of the first column is always at the top of the row. Doesn't look really nice.

How could i align the text of the first column in the vertical center of its row?

Thanks for help ;-)

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Vertical center alignment of data grid row

Post by Klaus » Fri Oct 31, 2014 12:47 pm

Hi AppleBite,

1. welcome to the forum! :D
2. Is this a datagrid of type FORM or TABLE?


Best

Klaus

AppleBite
Posts: 7
Joined: Fri Oct 31, 2014 10:25 am

Re: Vertical center alignment of data grid row

Post by AppleBite » Fri Oct 31, 2014 12:56 pm

Hi Klaus,

the style is "table".

regards from

Applebite

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Vertical center alignment of data grid row

Post by Klaus » Fri Oct 31, 2014 1:29 pm

Ah, OK, hmmm, that is not easy, I don't have any idea right now... :?

newtronsols
Posts: 192
Joined: Tue Mar 11, 2014 12:57 pm

Re: Vertical center alignment of data grid row

Post by newtronsols » Fri Oct 31, 2014 1:57 pm

Isn't that select "table" group, Property inspector, columns, align center for a selected column?

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Vertical center alignment of data grid row

Post by Klaus » Fri Oct 31, 2014 2:02 pm

newtronsols wrote:Isn't that select "table" group, Property inspector, columns, align center for a selected column?
That's all HORIZONTAL alignment and we don't want that, see thread title! 8)

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: Vertical center alignment of data grid row

Post by Monox18 » Sun Nov 07, 2021 10:40 pm

I came across to the same problem today to vertically center the rows. Basically you have to change the dgProps["default column behavior"] to a custom row behavior and change the field's topMargin to make it work. It's rather simple. Try the attached stack which contains a normal DG and a DG with centered rows.

Also posted on Bug #16542
DG Text Height.rar
(8.1 KiB) Downloaded 111 times
Last edited by Monox18 on Sun Nov 07, 2021 11:46 pm, edited 1 time in total.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Vertical center alignment of data grid row

Post by stam » Sun Nov 07, 2021 11:30 pm

AppleBite wrote:
Fri Oct 31, 2014 10:31 am
Now the text of the first column is always at the top of the row. Doesn't look really nice.
How could i align the text of the first column in the vertical center of its row?
You have edit the margins of the text in that cell, but it's not that straightforward.

You have to edit the template for the column: In the properties panel, in the 'Columns' Tab, select the column you want to edit and click the small button bottom right ('add custom column behaviour') if you haven't already.

This will bring up the column template (you can have templates for each column if you want, but not needed). You can return to this at any time from the 'data grid' tab and clicking the 'row template' button.

Then you need to edit group to get to the individual column and then edit group again.
Then you can edit the text field corresponding to the column directly. You'll want to change the margins - usually set to 8 or something like that. if a single digit, that means left/top/right/bottom margins are all that digit (eg 8,8,8,8) Just increase the 2nd item (top) and that should push your text down - eg set margins to 8,12,8,8

Hope that makes sense

Stam

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”