Change Height of Column Header in DataGrid

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
tj333
Posts: 12
Joined: Sat Jun 25, 2016 11:46 am

Change Height of Column Header in DataGrid

Post by tj333 » Sun Oct 16, 2016 6:46 pm

I made basic use of a DataGrid in my recent project. It worked fine, but when I run the app on Android the Column Header Name text is too tall for the Column Header and this caused the bottom of the Column Header name to get cut off.

I was able to easily change the row height in the DataGrid to 25px, but changing the Column Header height is proving more difficult.

I see in the documentation there is a dgProperty called Header Height. I tried adding

Code: Select all

set the dgProp[ Header Height ] of group "Data Grid" to 25
to the DataGrid script, but it didn't work.

I found this in the documentation, but I'm not quite sure what it means:

default header behavior

- The table style has an internal behavior that is used for column headers. If you would like to override the default behavior for column headers you can set this property to point to a button with your own behavior script.

To see the script that the data grid uses by default you can edit the script of button "Default Header" of group "Behaviors" of stack "revDataGridLibrary"

Thanks in advance for any help or suggestions,

TJ.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Change Height of Column Header in DataGrid

Post by jameshale » Mon Oct 17, 2016 1:14 am

The technique being described is detailed in this lesson from the Data Grid guide.
"How Do I Override the Default Behavior For Rendering Data to a Cell?"
You just need to use substitute default header behavior for default column behavior.

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Change Height of Column Header in DataGrid

Post by Mikey » Mon Oct 17, 2016 2:46 pm

You have to put "header height" in quotes.
set the dgprops["header height"] of group "dataGrid" to 38

tj333
Posts: 12
Joined: Sat Jun 25, 2016 11:46 am

Re: Change Height of Column Header in DataGrid

Post by tj333 » Mon Oct 17, 2016 7:22 pm

Thank you both for your advice. Obviously I need to go back and review the documentation in detail. Right now I'm still finding the DataGrid a bit confusing!

TJ.

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Change Height of Column Header in DataGrid

Post by Mikey » Mon Oct 17, 2016 7:35 pm

The DG is very sophisticated. You can do all sorts of nifty things with it. If you find it hard to use, though, you are probably trying too hard. I would focus less on tweaking the code and making custom layouts, and more on the properties you can set (those are in the back of the DG manual). At that point if you aren't sure what to do, ask for help before embarking on a safari.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”