hilighting text
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
hilighting text
Hi, does anyone know how to hilite (or hilight) an arbitrary portion of text in a field under script control? So, for example, if i want to hilite from char 5 to char 10 in field 1 what command could I use to do that? It is probably something very very obvious that I am overlooking so thanks for your suggestions.
-- Mark
-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: hilighting text
select character 5 to 10 of field 1
Re: hilighting text
Nearly... try
select character 5 to 10 of fld "field 1"
put the selectedtext into fld "field 2"
select character 5 to 10 of fld "field 1"
put the selectedtext into fld "field 2"
Andy .... LC CLASSIC ROCKS!
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: hilighting text
Thanks guys... I was overthinking this one. I was looking everywhere for a "hilite" command and couldn't find it... so "select" is the ticket.
Thanks
-- Mark
Thanks
-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: hilighting text
Mark,
I've used backColor character by character to track multistage parsing of large texts for version changes, keywords, phrases, proper names, etc. It can get cumbersome, but I needed to track many separate iterative parsing processes and it was easier than setting up a database or XML trees, once I had the subroutines built.
Walt
I've used backColor character by character to track multistage parsing of large texts for version changes, keywords, phrases, proper names, etc. It can get cumbersome, but I needed to track many separate iterative parsing processes and it was easier than setting up a database or XML trees, once I had the subroutines built.
Walt
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: hilighting text
HI Walt, something interesting I've noted (which is somewhat of a limitation in LC). When you highlight some text in a normal editing field and then do a right mouse click to popup a menu (this tested on a Mac), the highlighting disappears (and no attempt to get it back on my part has been successful). This does not conform to the way most applications function in such a situation. Normally the text remains highlighted while the popup has the focus.
Have you seen a way to circumvent this problem?
PS thanks for the advice re: highlighting keywords, phrases, proper names, etc. I'll keep the technique in mind (though it sounds painful
)
Have you seen a way to circumvent this problem?
PS thanks for the advice re: highlighting keywords, phrases, proper names, etc. I'll keep the technique in mind (though it sounds painful

macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: hilighting text
Hi Mark...
I have attached a stack that will get you started with keeping the highlight of the text in conjunction with a popUp menu...
be well
Dixie
I have attached a stack that will get you started with keeping the highlight of the text in conjunction with a popUp menu...
be well
Dixie
- Attachments
-
- keepHilight.livecode.zip
- (1.16 KiB) Downloaded 328 times
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: hilighting text
Oh how clever!! Now why didn't I think of thatDixie wrote:Hi Mark...
I have attached a stack that will get you started with keeping the highlight of the text in conjunction with a popUp menu...
be well
Dixie

macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: hilighting text
I'll try Dixie's stack, but what I saw was that if you set the backColor by character, word, or line, the result when you tested for the backColor of a word was inconsistent, almost as if characters, words, and lines had separate backColor settings. I don't have a clear enough understanding of the dynamics yet to offer a decent explanation.
Walt
Walt
Walt Brown
Omnis traductor traditor
Omnis traductor traditor