requestFocus() isn't setting highlight

Questions on using RSyntaxTextArea should go here.

Moderator: robert

requestFocus() isn't setting highlight

Postby majenko » Tue Aug 12, 2014 1:43 pm

I am guessing there is some extra command I need to run for this.

When I, fully programatically, open an RSTA, populate it with text, set all the colours, move the caret to a specific location, and then call .requestFocus(), everything works fine except the current line's highlight isn't painted until I actually click the mouse or move the cursor by hand.

I found forceCurrentLineHighlightRepaint() which looks like it might have done the trick, but it's protected, so I can't call it.

Is there some other trick to doing this, or is it a bug?

My current command sequence once the RSTA is open and populated is as simple as:
Code: Select all
textArea.setCaretPosition(textArea.getLineStartOffset(line));
textArea.requestFocus();

Oh, if the RSTA is already there and visible when I position and focus then it works. If it's a newly opened one then the line doesn't highlight.
majenko
 
Posts: 16
Joined: Sun Jul 14, 2013 11:01 am

Re: requestFocus() isn't setting highlight

Postby robert » Tue Aug 19, 2014 2:51 am

Sounds like a bug to me. I've added it on GitHub so it gets fixed in the next release. Thanks!
User avatar
robert
 
Posts: 805
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron