Force text to wrap around in a data grid form?

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
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Force text to wrap around in a data grid form?

Post by jalz » Wed Apr 02, 2014 12:11 am

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.

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: Force text to wrap around in a data grid form?

Post by keram » Wed Apr 02, 2014 5:18 am

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
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Force text to wrap around in a data grid form?

Post by jalz » Wed Apr 02, 2014 9:38 pm

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
Attachments
mygrid.livecode.zip
(4.71 KiB) Downloaded 195 times

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: Force text to wrap around in a data grid form?

Post by keram » Thu Apr 03, 2014 3:02 am

Hi jalz,

I have made changes so that you can get this display:
dataentry-jalz.jpg
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
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Force text to wrap around in a data grid form?

Post by jalz » Thu Apr 03, 2014 9:29 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Force text to wrap around in a data grid form?

Post by Klaus » Fri Apr 04, 2014 7:59 am

Hi jalz,
jalz wrote:... these datagrids are making me pull my hair out!
welcome to the club! :D


Best

Klaus

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: Force text to wrap around in a data grid form?

Post by keram » Fri Apr 04, 2014 10:34 am

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! :lol:

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
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

Post Reply