Page 1 of 1

Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 11:21 am
by user#606
Hi,
I am using a table field and not data grid, to store multi-line text in some cells along the line.
Apart from some fields containing name, email, phone number, which are all single line items for visual selection, others will comtain multi-line notes.
As the line in the table is hovered over, the full content of the line in the field is displayed at the head of the card in its full readable form.
The reason for this approach is speed of cobbling it together, it must be working tomorrow.
The table contents can be easily stored and retrieved from disk.
The notes are not visible in the table.
That is the way I want it.

The return char causes the notes to occupy more than one line in the table when copied to the table, from the display field at the head of the card.
I need a simple way of compacting the notes text so the return char does not mess things up.
The obvious way is to chance the Ret char to a different character and then change it back for display. I dont have time for this.
I might consider encrypt decrypt, because it is a reliable from a testing point of view, but sorting out the codeing might take time. Also, the encrypt/decrypt time might be significant when hovering over the line to display the full content.

Any better/good ideas?

Re: Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 1:02 pm
by user#606
Problem solved!
For others users benefit.

To change the RETURN char to an obscure character not likely to be used with the text input:-
on mouseUp
replace RETURN with "N" in field "input"-- changes all RETURNS to Ns (or an unused or obscure char) in the whole string
end mouseUp end mouseUp

Then put field"input" into the item and line of the table field (so it stays on the one line)
To convert back for display, swap the RETURN N values to convert the text back as it was in the displayed field

Re: Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 1:19 pm
by Klaus
Hi,

do not replace a character that might be part of the text!
This is asking for trouble :D

Instead use URLENCODE and URLDECODE, which is the best solution for this kind of problem!
This will convert all CRs and TABs etc. so you end with ONE line of text!
...
put urlencode(fld "many lines") into tVariableWithOneLine
...
put urldecode(tVariableWithOneLine) into fld "even more lines..."
...

Best

Klaus

Re: Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 1:29 pm
by user#606
Sounds a better solution.
Thank you Oh wise one!

Re: Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 1:37 pm
by Klaus
8)

Re: Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 3:43 pm
by user#606
The downside to using put urlencode(fld ........ is that in visible fields, this nshows up as + signs between all words and numbers where there is a space between.
Whereas, in my suggestion, only the unique character appears where the RETURN was, making it more readable.
I only mention this, because someone else might find this a problem, if they have the text visible in the table.

Re: Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 4:10 pm
by Klaus
Oh, sorry, looks like I misunderstood your question.
Didn't notice that the fields are also visible.
Yes, then replacing CR with something uncommon will be the right way.

Re: Help with table field in 5.5.3

Posted: Sun Jan 20, 2013 8:03 pm
by jacque
I like this:

replace cr with numToChar(166) in tText

This is the paragraph glyph. Visually it looks like the paragraph symbol and people don't usually type it. If you are worried they might, block that character by trapping it in a keydown handler in the field:

on keydown pKey
if pKey is not numToChar(166) then pass keydown
end keydown