Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change color of a substring of a caption
Message
 
 
To
06/03/2019 15:44:49
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01666960
Message ID:
01667038
Views:
53
>>Hi,
>>
>>I have a window/form that has many check boxes. Each check box has a caption. I want to add a text box at the top of the form so that the user can search for any check box caption which contains the entered text. For example, when a user enters "fox", a method of the form will scan all check boxes and check if the caption has the word "fox." So far, it is all fairly easy to do.
>>
>>But then I want the substring of the caption to change the color (or make it bold). For example, if a check box has a caption
>>"Visual FoxPro" I want the word/substring "Fox" to be highlighted by a color or make it bold.
>>
>>Is this possible? And if yes, how? TIA
>
>I don't know if this has been mentioned, but maybe you could compromise - if there is a partial match on a given caption, change the colour of the entire caption - or make it bold etc.
>
>In a form with many checkboxes/captions, that would make them easier to find at a glance. It would let them see, "this checkbox matches your search". If their search string is something "slim" like "Il", that may be only a portion of a given caption, and be hard to spot.
>
>Do you actually need to show the user why a given checkbox matches their search?

This is exactly what I ended up doing, so far - change/make the entire caption where there is a match to bold.
No, there is no requirement to make just the sub-string of the caption in a different color. I simply thought I was missing something simple and wanted to explore other options.

But the example created by Rick Hodgin works very nicely. I may try to apply it to my case, if I have time.

You may have noticed that I operate like a fire department - I get a fire, put it out any way I can, and get to another fire.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform