Page 1 of 1
Force text to wrap around in a data grid form?
Posted: Wed Apr 02, 2014 12:11 am
by jalz
Hi all,
Still playing with data grids and have discovered another issue with the way the data is presented on my form. I've created a data entry stack which has a field called description in it which is approximately 400 wide and 300 in height. When I type a long word, during testing I am using random characters for testing without a space and the word exceeds the 400 pixels wide limit. I am expecting the word to wrap around onto the next line, but it doesn't. Nevermind, I think that once I dispatch the data to the dgtext in the data grid, the description label will wrap it as I have other fields/labels on the template but unfortunately the label field here just allows the text to overflow and overlap the other fields on my data grid form.
Is there anyway I can force the text to wrap around in the form, I'm trying to prevent the overlapping of fields on my layout.
Thanks as always.
Re: Force text to wrap around in a data grid form?
Posted: Wed Apr 02, 2014 5:18 am
by keram
Hi jalz,
jalz wrote:I have other fields/labels on the template but unfortunately the label field here just allows the text to overflow and overlap the other fields on my data grid form
Did you place it properly in the Row Template design?
It would be easier to try to figure out solution if you post the stack as well.
keram
Re: Force text to wrap around in a data grid form?
Posted: Wed Apr 02, 2014 9:38 pm
by jalz
Hi Keram,
I've knocked together a simple file here. If you press on the New button, you should see an input screen with two fields, description and price. Enter values in both fields, but if you type in a long word in the description box (i.e. abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz) without a space, I would expect the word to wrap around in the description box but it seems to continue scrolling to the right. Whats more important is on save, the value is dispatched to the datagrid and the value seems to overlap the price field, when I would prefer it if the field in the data grid displayed as much as the field defined by the width.
Thanks
Jalz
Re: Force text to wrap around in a data grid form?
Posted: Thu Apr 03, 2014 3:02 am
by keram
Hi jalz,
I have made changes so that you can get this display:
1. to get the line like the one with price 150 is simple and quick:
put this line: put item 3 of pControlRect - 99 into item 3 of theFieldRect
into LayoutControl, you had much smaller number than 99
2. to get the description wrapping like in the lines with prices 103 and 105 (I split the huge line that you used since it's not realistic anyway)
have a look at this lesson:
http://lessons.runrev.com/s/lessons/m/d ... ne-heights
keram
Re: Force text to wrap around in a data grid form?
Posted: Thu Apr 03, 2014 9:29 pm
by jalz
Hi Keram,
That seemed to do the trick for my example file. Now I'm going to try and apply it to my real stack - I've still got a lot to learn, these datagrids are making me pull my hair out!
Cheers
Jalz
Re: Force text to wrap around in a data grid form?
Posted: Fri Apr 04, 2014 7:59 am
by Klaus
Hi jalz,
jalz wrote:... these datagrids are making me pull my hair out!
welcome to the club!
Best
Klaus
Re: Force text to wrap around in a data grid form?
Posted: Fri Apr 04, 2014 10:34 am
by keram
Hi Jalz,
jalz wrote:these datagrids are making me pull my hair out!
Same here, in 5 months I've lost all my hair. See, even the Great Klaus is in the same DG Club!
There are just few people that have mastered data grids. One of them is Zryip TheSlug who actually created a Data Grid Helper
http://www.aslugontheroad.com/ - a plugin for LiveCode but only LC Commercial version so I was not able to try it. Zryip says that he is working on another version that will run on LC Community.
I know that Terry (TerryL) is preparing a nice stack with useful data grid tricks. Hopefully she will post it soon.
keram