Re: textview widget selection buffer_select_range is cleared when dialog closes (intermittently?)



On 02/22/2017 12:34 AM, David C. Rankin wrote:
All,

  I have a textview widget being used in an editor where an incremental search
is performed. The matched words are highlighted with:

gtk_text_buffer_select_range (buffer, &mstart, &mend);

  After the last match in the search range (either whole buffer, from cursor
[insert mark] or by selection), a gtk_message_dialog is displayed asking if
the user would like to "Continue search from beginning?".

  The search then continues from the beginning of the buffer (or selected
range). What is weird, is depending on 'how quickly' the user clicks 'Yes'
button, the selection (implemented immediately on close of the dialog if 'Yes'
is chosen) can be removed from the matched word as focus from the dialog is
returned to the textview.

  Is there some standard way to prevent the closing of a dialog from impacting
an active selection in the parent window?

(with Gtk+ 2.24)


Opps,

  If you need to see the implementation, it is the 'find' function in:

https://github.com/drankinatty/gtkwrite/blob/master/gtk_findreplace.c

-- 
David C. Rankin, J.D.,P.E.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]