Subscribe Bookmark RSS Feed

Set focus of display tree (new window) to text edit box

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Hi, I would like to be able to make the text in a text edit box highlighted via script.  I'd like to be able to type in a string, hit enter, have the script store that value and do its thing, then put the focus back on the text edit box for further entry.  Below is a stripped down example of what i'm trying to do. 

Thanks,

Mike

Clear Log();

Names Default To Here( 1 );

Fn = function({x},

     

      myText = teb << get text();

      show(myText);

     

      teb << set selected(); // <-- here's where i'm trying to select the text edit box.

);

win = new window("title",

      vlistbox(

            teb = text edit box(""),

            buttonbox("Test", Fn(1))

      )

);

teb << set script(Fn(1));   // runs the "Fn" function when the enter key is pressed within the text edit box.

2 REPLIES
David_Burnham

Super User

Joined:

Jul 13, 2011

You could try this:

buttonbox("Test", Fn(1), <<Restore Focus After Click)

-Dave

-Dave
mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Thanks. That solves part of the problem, which was bringing focus back to the edit box after clicking on the button box.  Do you know how to bring focus back to the edit box after entering in data and hitting 'enter' key?

-Mike