cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
nikles
Level VI

Possible to automatically highlight a substring within a text edit box?

Hi.  I'm wondering if anyone knows of a method where my script can automatically highlight a substring within a text edit box?  I'd like the user to be able to

1. Click on the text within the TEB at a specific location.

2. A "<< Set Text Changed" function would return the location of the cursor in the text field using a yet-to-be-determined command.

3. The script looks around the cursor location for predefined delimiters in the text.

4. Finally it highlights the text between the delimiters.

I briefly explored using a MouseBox wrapper, but at first blush there doesn't appear to be any easy way for JMP to associate mouse position with the underlying text.  Plus, even if I could figure that out, there doesn't appear to be any way to have JMP highlight substrings within a text edit box (none that I could find at least).  

 

Perhaps there's another type of display box I could employ to do this?

 

JMP Pro 16.2

macOS Big Sur 11.6.5

 

Any help is appreciated.  Thanks.

3 REPLIES 3
pmroz
Super User

Re: Possible to automatically highlight a substring within a text edit box?

Textboxes can use a simple markup for bold, italic and underlining.  Look in the scripting index at text boxes, for markup.

Names Default To Here( 1 );
example_text = 
"This is <b>bold</b> text. This is <i>italic</i> text. This is <u>underlined</u> text. 
This is <b><i><u>bold, italic, underlined</u></i></b> text.";
win = New Window( "Example", tb = Text Box( example_text ) );
tb << markup;

pmroz_0-1652463998246.png

 

nikles
Level VI

Re: Possible to automatically highlight a substring within a text edit box?

I'm aware of this feature, but text boxes do not allow the user to manually select the text within them, nor do they have any way to execute a function when clicking on them.  I'm looking for something where the user can click on, say, a single word in the text string, and a function will automatically select the entire word.

pmroz
Super User

Re: Possible to automatically highlight a substring within a text edit box?

You can use a text edit box to allow users to click on the text.  If you double-click on a word the entire word will be selected.