[Gambas-user] Editor.Lines[0].Refresh() does not trigger custom Highlight event

Tobias Boege taboege at ...626...
Sun Mar 10 14:13:55 CET 2013


On Sun, 10 Mar 2013, Beno?t Minisini wrote:
> Le 09/03/2013 20:11, Tobias Boege a ?crit :
> > On Sat, 09 Mar 2013, Beno?t Minisini wrote:
> >> Le 09/03/2013 18:10, Tobias Boege a ?crit :
> >>> Hi,
> >>>
> >>> the attached project shows how just for line 0, the
> >>> Editor.Lines[0].Refresh() method does not force the Highlight event to kick
> >>> in (if I have Editor.Highlight = Highlight.Custom set).
> >>>
> >>> Is there a reason or is it just a bug?
> >>>
> >>> Regards,
> >>> Tobi
> >>>
> >>
> >> Refresh() just triggers a GUI redraw. It has nothing to do with the
> >> Highlight event, that is raised when the editor decides.
> >>
> >
> > Alright. It looked like it did force a Highlight event with all the other
> > line numbers but ok... I now get what I want by resetting Editor.Highlight
> > and then Editor.Goto() one line back and forth. Not really beautiful but
> > seems to work consistently.
> >
> > In case anyone wonders: I'm implementing kind of Editor.ShowString() and
> > Replace$() for use with regular expressions. This requires highlighting the
> > entire text again with a new search query. The Editor doesn't really fit my
> > needs (as my hack above shows) but out of all controls it comes the most
> > close to it I think...
> >
> > Regards,
> > Tobi
> >
> 
> I don't understand what you want to do exactly with Editor. Could you 
> explain with more details?
> 

Of course. I wasn't clear at all. The goal is to enter a regular expression
and then highlight all matching strings in a text (like Editor.ShowString()
does for fixed strings).

One may also replace all matches by another string (currently not containing
submatches of the original expression because it was just a POC for an
article about gb.pcre). I'd just leave this task to an invocation of 'sed'.

BTW, I finished the thing yesterday and the attached code may show better
what I was trying to explain.

Regards,
Tobi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: regex_search_replace-1.0.1.tar.gz
Type: application/octet-stream
Size: 6781 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130310/fe3c0b81/attachment.obj>


More information about the User mailing list