The other day I discovered that some data I was trying to display in a TEXT control was being truncated. At first I thought it was because of the way I was using the text control, here was my initial question on the CW-Talk skype chat:

Ok, I have one for you… So I have this on a window:


and at runtime put a string into the control like this:

?MyText{PROP:Text} = ‘blah blah’

Not sure why I used PROP:Text but it turns out this seems to work, mostly. However, it appears to have a limit of around 1000 chrs. My question, is this a valid way to use the TEXT control?
Follow up questions, is there a way to use the text control in the way I have declared it, without a variable, but not be limited in length?

Of course as soon as I posted it I figured out what I was doing wrong. Everywhere in my procedure I was using a string class to provide dynamically sized storage for the string data I was using except in this one place that was just before it was being shown on the window… In that case I was first saving the data to an IMDD (In Memory Database Driver) table using a CSTRING(1000). So of course, my displayed data was no bigger than 1000 characters!

Ok, since Clarion, and the IMDD, only have fixed sized data types for strings what could I do? I could pick a bigger number for my CSTRING but really, it could be any size and I want to support that. An IMDD has limit on the data types it supports so it is not possible to have a class or a class reference directly but since this is a memory table and I have no need to serialize this in anyway the best solution I could think of was to NEW() my string class and store the address in the IMDD table.

Here is the quick and dirty class I created for helping with the to and from business of dealing with the references. It takes some care to implement correctly in order to avoid memory leaks but it is pretty clean and is working quite well for me, perhaps you may find it helpful also!