Custom text and rich text editing?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hyphz
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1
Joined: Tue Feb 16, 2010 7:26 pm

Custom text and rich text editing?

Post by hyphz » Tue Feb 16, 2010 7:36 pm

Hi,

Is there any support in Rev, or an add-on, that will allow creating an editor with custom syntax highlighting? Or writing a program that will respond to changes in a large text file (rather than a simple text entry field)? I'm thinking about something along the lines of TodoPaper.

Thanks!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Custom text and rich text editing?

Post by Mark » Wed Feb 17, 2010 12:14 pm

hyphz,

You'll have to parse the htmlText. For example, you could replace words with the same words surrounded by font tags:

Code: Select all

replace " red " with " <font color=red>red</font> " in myData
You will need to figure out how to do this in a smart way. For example, it isn't always necessary to parse the complete text.

Another possibility might be to use a repear loop:

Code: Select all

lock screen
repeat with x = 1 to number of words of fld y
  put colorArray[word x of fld y] into myColor
  if myColor is not empty then set the textColor of word x of fld y to myColor
end repeat
unlock screen
You could apply such a repeat loop to the line that is currently being edited or even to the last word(s) entered only.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply