Changing or deleting the found text rectangle

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
Lynn P.
Posts: 79
Joined: Sun Apr 09, 2006 1:09 pm

Changing or deleting the found text rectangle

Post by Lynn P. » Sat Nov 29, 2008 5:46 pm

Hi all ~
In my constant quest for simplicity..
There are times I would prefer that text which is found in an app by the find command in a script is either not pointed out by the "found rectangle" put around the text, as it is not a search for the user to directly see the search result pointed out... and at other times I wish to have the text pointed out a different way such as changing the text color, highlight or style properties.

My question is...
Is there a quick or more elegant way to remove the rectangle than what I've come up with.
I usually do something like:

Code: Select all

  set the lockScreen to true --to hide the insertion cursor blinking
  find whole "lookForThis" in fld "FieldToSearch"
  set the textColor of the foundText to red -- do the preferred highlighting
  select after text of fld "FieldToSearch" -- get rid of the rectangle
  select after text of fld "HiddenField" 
--moves insertion cursor out of the "FieldToSearch" text field

Thanks for any input. Maybe I'm just missing something in the docs and my online search, and there is a really easy way to do this.
Lynn P.
Rev 2.8.1 / Mac OS 10.4.11

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Sat Nov 29, 2008 7:37 pm

Hi Lynn,

Code: Select all

...
## Colorize the found text
set the textColor of the FOUNDCHUNK to red 

## Remove FIND rectangel 
select empty
...
might do the job :-)


Best

Klaus

Lynn P.
Posts: 79
Joined: Sun Apr 09, 2006 1:09 pm

Post by Lynn P. » Sat Nov 29, 2008 9:33 pm

Thanks Klaus ~
I must have some text field property set incorrectly or my copy of Rev is having fits about "Select empty" because after reading the docs, select empty should work in getting rid of the rectangle, but in my case.. it has decided it didn't want to be ignored. <g>
I thought something may have become corrupted, so I did a simple new stack with a regular text field (not a label), put some text in and added your code to a button, and it turned the "foundChunk" red as it should but the "select empty" did nothing.
I have no doubt "select empty" works however as I've been having wacko moments with my copy of Rev lately. I may reinstall a pristine version and try again. Obviously, "select empty" is exactly what I need. I just have to convince my copy of Rev. LOL!

Thanks for the help Klaus!

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Post by bangkok » Sat Nov 29, 2008 9:41 pm

What about

Code: Select all

find empty
For me, the

Code: Select all

select empty
doesn't work.

Lynn P.
Posts: 79
Joined: Sun Apr 09, 2006 1:09 pm

Post by Lynn P. » Sat Nov 29, 2008 10:45 pm

bangkok wrote:What about
find empty
For me, the select empty doesn't work.
Thanks bangkok!
That works great. I tried the 'select empty' on an old 2.6 version of Rev and on another machine with a pristine copy of Rev 2.8 to no avail, although it still irks me because it should work. But 'find empty' works great as it cleans up the messy code I had.

I appreciate your time and the help from both of you. :)

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Sun Nov 30, 2008 12:17 pm

YES! Slaponforehead :-)

"find empty" is correct, since the text was not SELECted but found, so this is definitively logical.

Have a nice day!


Best

Klaus

Lynn P.
Posts: 79
Joined: Sun Apr 09, 2006 1:09 pm

Post by Lynn P. » Sun Nov 30, 2008 4:44 pm

Klaus wrote:YES! Slaponforehead :-)
"find empty" is correct, since the text was not SELECted but found, so this is definitively logical.
Oh sure... throw logic in there! LOL!

Yep. That makes sense now. Thanks for pointing that out Klaus. If I understand the logic and reasoning behind something, my brain neurons tend to respect it more and keep the info around instead of letting it exit the other ear. <g>

Post Reply