Hieght of data grid, without scrollbars
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Hieght of data grid, without scrollbars
Hi there,
I am trying to get a data grid, for all intents and purposes, to re-size in height in the same fashion a text field does when fit content is selected.
I have a data grid inside a mobGUI scroller group. Set to form type. no scrollbars.
So at the moment i am testing with static content, a string on each row, some 20 rows.
So ok, i can set the height to suit at the moment.
But in the app the content will be generated by the user. So how can i get the data grid to re-size it's height dependent on the size of the content.
I can think of a way to script this. Count the number of rows present and multiply by my row height, then set the height to the answer.
Is this the only way to set the height of the grid when new content is generated...?
I am trying to get a data grid, for all intents and purposes, to re-size in height in the same fashion a text field does when fit content is selected.
I have a data grid inside a mobGUI scroller group. Set to form type. no scrollbars.
So at the moment i am testing with static content, a string on each row, some 20 rows.
So ok, i can set the height to suit at the moment.
But in the app the content will be generated by the user. So how can i get the data grid to re-size it's height dependent on the size of the content.
I can think of a way to script this. Count the number of rows present and multiply by my row height, then set the height to the answer.
Is this the only way to set the height of the grid when new content is generated...?
Kind Regards
Gary
https://www.doobox.co.uk
Gary
https://www.doobox.co.uk
Re: Hieght of data grid, without scrollbars
I don't think that datagrids, as fields themselves do not, have any native property that expands (or contracts) them to fit content. The answer dialog, for example, does this but it and its ilk are a special case.
I don't use datagrids much, but what you propose sounds like a straightforward and logical method, what most would do with simple fields.There are many messages you can trap to update the dg's height, either before the user accesses or after he modifies the data.
Craig Newman
I don't use datagrids much, but what you propose sounds like a straightforward and logical method, what most would do with simple fields.There are many messages you can trap to update the dg's height, either before the user accesses or after he modifies the data.
Craig Newman
Re: Hieght of data grid, without scrollbars
Hi Craig,
Thank you...
If i understand you correctly, your saying even with a text field, there is not a way to mimic the behaviour of clicking "fit content" in the property inspector, at runtime.
I will run with my initial thought of updating the height based on the number of rows (known height).
Thank you...
If i understand you correctly, your saying even with a text field, there is not a way to mimic the behaviour of clicking "fit content" in the property inspector, at runtime.
I will run with my initial thought of updating the height based on the number of rows (known height).
Kind Regards
Gary
https://www.doobox.co.uk
Gary
https://www.doobox.co.uk
Re: Hieght of data grid, without scrollbars
Hi Gary,
for fields you can do:
...
set the height of fld X to the formattedheight of fld X
## same with width -> formattedwidth
...
But I did not find something similar for datagrids in the DataGrid docs.
Best
Klaus
for fields you can do:
...
set the height of fld X to the formattedheight of fld X
## same with width -> formattedwidth
...
But I did not find something similar for datagrids in the DataGrid docs.
Best
Klaus
Re: Hieght of data grid, without scrollbars
Thank's Klaus,
This is almost as quick anyway, it just seemed at the start that it may have ended up a little long winded.
This is almost as quick anyway, it just seemed at the start that it may have ended up a little long winded.
Code: Select all
put the dgNumberOfLines of group "DataGrid 1" into tTempvar
put tTempvar * 70 into tNewHeight
set the height of group "DataGrid 1" to tNewHeight
Kind Regards
Gary
https://www.doobox.co.uk
Gary
https://www.doobox.co.uk
Re: Hieght of data grid, without scrollbars
Try
the dgFormattedHeight of grp "YourDataGridName"
HTH
cheers
Alan
the dgFormattedHeight of grp "YourDataGridName"
HTH
cheers
Alan