I am trying to create a data grid where the height of the row expands as the 
user types in the row and adds new lines.  

I have managed to have the data grid row resize when the data is loaded  or the 
data is refreshed with the following handler
in the behaviour script for the row.

on LayoutControl pControlRect, pWorkingRect

## Expand field to fill in available width

put the rect of field "Comments" of me into tVariableHeightTextFieldRect

put item 3 of pControlRect -5 into item 3 of tVariableHeightTextFieldRect

set the rect of field "JudgesComments" of me to tVariableHeightTextFieldRect

## Resize field height to fit content

put item 2 of tVariableHeightTextFieldRect + the formattedheight of field 
"Comments" of me \

into item 4 of tVariableHeightTextFieldRect

set the rect of field "Comments" of me to tVariableHeightTextFieldRect

## Update the bounding rect to match total height

## that you want this row to have

put item 4 of tVariableHeightTextFieldRect into item 4 of pControlRect

## Resize Row to take in text field height

set the rect of graphic "Background" of me to pControlRect

end LayoutControl

Using this when I set the dgData of the DataGrid the row height is set based on 
the formatted height of the “comments” field.

However this does not work dynamically while typing.

I found an answer to this question on stack overflow by LiveCode’s own Monte 

However I wasn’t sure if this still works given that it says to copy the script 
of the field editor behaviour button from the revDataGridLibrary stack.

In LiveCode 9.6 there isn't a revDataGridLibrary stack with a field editor 
behavior button. In LiveCode version 8 the IDE started to be refactored with 
the behaviour buttons on binary stacks changed to script only stacks. 

Now, I see there is a script only stack 

So instead of copying the button I created a new button on the card with the 
row template and copied the script from the script only stack with the Field 
editor Button’s  b ehaviour to it and then added the code above to that 
button's script.

I then commented out the changes that I made to the layoutControl handler above 
to make sure that didn’t interfere with Monte’s solution.

That did not work.   

Monte’s solutions talks about a field editor being created and used while 
editing the text.   Is this still done in LiveCode 9.6?

If anyone has any suggestions of how to resized a row dynamically while user 
adds lines to a field that would be great.

Also I am trying to update the dgData of the DataGrid and add the new data 
typed by the user, but I can’t get that working either.

Thanks in advance for any help.

Martin Koob

BTW I don’t understand how Stack Overflow works.   I posted this question in 
response to Monte’s answer and it got deleted.  
https://stackoverflow.com/a/62499552/12863578 "This post is hidden. It was 
deleted 3 hours ago by Bhargav Rao♦”.  I thought it was a legitimate question 
relating to the answer,  basically ‘has this answer changed given a new OS?",   
I even provided a link to an article by Mark W explaining the change in the 
move to Script only Stacks in the IDE. I find it a very unfriendly place.   So 
back here to the friendly environment of the use-livecode list.


use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to