Vertical center alignment of data grid row
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Vertical center alignment of data grid row
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
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
Re: Vertical center alignment of data grid row
Hi AppleBite,
1. welcome to the forum!
2. Is this a datagrid of type FORM or TABLE?
Best
Klaus
1. welcome to the forum!
2. Is this a datagrid of type FORM or TABLE?
Best
Klaus
Re: Vertical center alignment of data grid row
Hi Klaus,
the style is "table".
regards from
Applebite
the style is "table".
regards from
Applebite
Re: Vertical center alignment of data grid row
Ah, OK, hmmm, that is not easy, I don't have any idea right now...
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
Re: Vertical center alignment of data grid row
Isn't that select "table" group, Property inspector, columns, align center for a selected column?
Re: Vertical center alignment of data grid row
That's all HORIZONTAL alignment and we don't want that, see thread title!newtronsols wrote:Isn't that select "table" group, Property inspector, columns, align center for a selected column?
Re: Vertical center alignment of data grid row
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
Also posted on Bug #16542
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/
Developing a Cyber Physical System.
https://www.monoxware.com/
Re: Vertical center alignment of data grid 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