copying formatted text from one field to another

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

copying formatted text from one field to another

Post by jalz » Thu Apr 10, 2014 12:03 am

Hey all,

I have a text field in one stack called description. Within that field I have some formatted text and I wish to copy the contents of that field including the formatting/styles to a label in the data grid.

I have the following the script which copies the fields into an array and into my data grid

Code: Select all

   put fld "fld_description" into theDataA["label 2"]
   put fld "fld_item_price" into theDataA["label 3"]
   put fld "fld_qty" into theDataA["label 4"]
   put fld "fld_line_price" into theDataA["label 5"]
   
   dispatch "AddData" to group "PurchaseGrid" of stack "DataEntry" with theDataA
Trawling through the forums, I have found that I need to use the htmlText command to retain the formatting within the field. I've checked the dictionary for the syntax and I believe I need to replace the top line with the following code set the HTMLText of field "fld_description" to theDataA["label 2"] as Im trying to store everything in an array before I dispatch. However this doesn't work, intact the dispatch is empty.

Any pointers on how I can achieve this relatively simply?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: copying formatted text from one field to another

Post by FourthWorld » Thu Apr 10, 2014 1:51 am

You're close - try:

put the hmlText of fld "fld_description" into theDataA["label 2"]
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply