Can you hilite the Find commands found text?

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
urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

Can you hilite the Find commands found text?

Post by urbaud » Fri Oct 09, 2009 2:46 am

I’m using the Find command to find segments of text within a larger body of text. As you know, when the desired segment is found, the Find command puts a “boxâ€
urbaud

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

Post by FourthWorld » Fri Oct 09, 2009 3:20 am

See the foundText function.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

Post by urbaud » Fri Oct 09, 2009 8:13 pm

Hi Richard,

Thanks for the quick reply. I think I am using the “foundtextâ€
urbaud

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

Post by FourthWorld » Fri Oct 09, 2009 8:55 pm

You can use the foundText chunk description to do anything you want with the chunk; you can select it, or set its backgroundColor, etc.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

Post by urbaud » Sun Oct 11, 2009 1:42 am

Hi Richard,

Can you direct me to a link that will show me the syntax to change the background color of the foundText chunk , the dictionary doesn't show how to do that. By the way, what is it with the dictionary-many times I look something up and try the examples and they don't work. For example, the dictionary has the line: "the foundText" as part of the example, but if I put it into an onMouseUp handler, it generates an error message. Do you know of a good source for Revolution syntax, if so, what is it. I find the information about Revolution commands, functions, etc sorely lacking. I have Schaffers book and it is somewhat helpful, but I wish there was some other good source. I have looked at the course stuff from BYU-it's pretty good. Any further help you can provide would be much appreciated.
urbaud

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

Post by FourthWorld » Sun Oct 11, 2009 3:35 am

Dude, ya' gotta experiment. You'll be surprised by how easy these types of things are in Rev, and the more you experiment the quicker you'll get the hang of it.

We know from the dictionary entry for foundChunk that it returns a description that uses a chunk expression, and that we can assign the background color to a portion of a field's text using a chunk expression, so putting the two together gives us:

Code: Select all

on mouseUp
  find "something" in fld 1
  set the backgroundcolor of the foundChunk to "blue"
end mouseUp
:)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply