Fl_Text_Buffer or Fl_Text_Editor Callback?

22 views
Skip to first unread message

Svets

unread,
Apr 29, 2015, 12:12:49 PM4/29/15
to fltkg...@googlegroups.com
Hi Everybody :)

I'm having a little bit of trouble trying to add some single quotes to a database.  I realize you have to escape them or add two single qoutes.

What I'm want to do is have a callback function which is activated when I paste data into the Fl_Text_Editor.  The data is then automatically amended via a callback to correct all single quotes ' into two single quotes ' ' .

While the Fl_Text_Editor does have a callback function it does not call the callback when I change data in it or paste data into the text editor. This is probably because it's the Fl_Text_Buffer I should be focussing on.  Unfortunately the Fl_Text_Buffer does not have a callback mechanism so I can't do what I want to do (as I tried with the Fl_Text_Editor).

Would anyone know how I can trigger a callback to be called when I paste data into or edit data in a Fl_Text_Editor?

Thanks

Svets

unread,
Apr 29, 2015, 12:29:27 PM4/29/15
to fltkg...@googlegroups.com
Fixed it. Forgot about this ;)

 Fl_Text_Editor::when(FL_WHEN_CHANGED);

Greg Ercolano

unread,
Apr 29, 2015, 12:29:34 PM4/29/15
to fltkg...@googlegroups.com
On 04/29/15 09:12, Svets wrote:
> Would anyone know how I can trigger a callback to be called when
> I paste data into or edit data in a Fl_Text_Editor?

Pretty sure Fl_Text_Buffer::add_modify_callback() is what you want:
http://www.fltk.org/doc-1.3/classFl__Text__Buffer.html#a6a72d422478508c94baf5b6a7bc46740

This is I think how e.g. the fluid code editor handles inline
syntax highlighting and such..

Svets

unread,
May 5, 2015, 3:59:12 AM5/5/15
to fltkg...@googlegroups.com, erco_...@seriss.com
Thanks.. I missed that.  Works well. 
Reply all
Reply to author
Forward
0 new messages