Carriage Return in datagrid data

Pete pete at mollysrevenge.com
Wed Jan 4 18:48:40 EST 2012


Hi Mike,
Thanks, yes I'm familiar with using dgData - it was how the data looks in
the datagrid that I wasn't sure of.

I did an experiment with a single column datagrid, loading some text plus a
carriage return, plus more text into via dgData.  What happens is that all
of the text after the carriage return gets lost because of the fixed row
height of the datagrid  (it's still there of course, just can't see it).

On the other hand, if I use the VT character to replace the carriage
return, the text is visible in the datagrid column (at least up to its
width) and I see the VT character in the string.

Hope that makes sense.  Basically if the text is

abc
def
ghi

...then leaving the returns in there shows me only "abc" but using the VY
character shows me "abc<VT>def<VT>ghi" so all the data is visible. I could
increase the row height of course but not all the rows I'm displaying will
have carriage returns in them so would be wasting some datagrid space.

Either way, I probably will convert to using dgData instead of dgText.  I
kinda prefer using dgData but it's just an extra step to convert what comes
back from the database into an array when it's already in dgText format.

Pete

On Wed, Jan 4, 2012 at 2:05 PM, Michael Doub <mike at doub.com> wrote:

>
> Let say we have a variable Contacts where each line has 4 tab delimited
> fields: RecID, Name, Age, BirthDay
> The following builds the dgData array.  The first index controls the order
> of what is displayed in the datagrid.
> If you look closely you will see that it[Counter] = pDataArray that you
> deal with in the Row Behaviour script.
>
> Hope this helps,
>   Mike
>
>
> Global Contacts
> on openCard
>   local x;
>   local Counter; put 1 into counter
>   put empty into it
>   set itemdel to tab
>   repeat for each line x in Contacts
>      put item 1 of x into it[Counter]["RecID"]
>      put item 2 of x into it[Counter]["Name"]
>      put item 3 of x into it[Counter]["Age"]
>      put item 4 of x into it[Counter]["Birthday"]
>      add 1 to counter
>   end repeat
>   set the dgData of group "SetGroup" to it
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list