Author Topic: Editor Control on_change event  (Read 5409 times)

ronburk

  • Community Member
  • Posts: 22
  • Hero Points: 3
Editor Control on_change event
« on: September 02, 2006, 05:22:49 pm »
There doesn't seem to be an on_change event for Editor Controls.
How do I, well, detect when a change has been made?

gary_ash

  • Guest
Re: Editor Control on_change event
« Reply #1 on: September 02, 2006, 06:18:52 pm »
I couldn't find one either so when i wrote my GenComment,
http://www.wideopenwest.com/~gary_ash/GenComment.htm, package i just created a very wide ranging keyboard hook. What is it you're trying to do?

ronburk

  • Community Member
  • Posts: 22
  • Hero Points: 3
Re: Editor Control on_change event
« Reply #2 on: September 02, 2006, 08:11:09 pm »
Right now, just the typical: "Save" button is enabled/disabled
to indicate whether there are unsaved changes in the
Editor Control.

I considered the "hook every dang thing" approach, but worried
I would miss some route to modifying the buffer. So now I poll
the p_modify flag with a timer (ugh). Hard to decide which evil
is lesser.

It seems very strange to have an on_change event for other
object times and not for the Editor Control.

On the bright side, I found there is an xml_mode() method
for Editor Controls, even though no such method appears in
the documentation.

gary_ash

  • Guest
Re: Editor Control on_change event
« Reply #3 on: September 02, 2006, 10:48:09 pm »
Have you tried writing an _OnUpdate handler. I don't think they work for forms though
a keyboard hook my be your only option

Graeme

  • Senior Community Member
  • Posts: 2323
  • Hero Points: 305
Re: Editor Control on_change event
« Reply #4 on: September 02, 2006, 11:39:49 pm »

There is the VSCALLBACK_AR_BUF_TEXT_CHANGE callback  -  dunno if it works though.
I use a timer for this - works fine for me.

You could also modify the _update_mod_file_status in bufftabs.e or the _as_callback function in autosave.e to add a call to your own function.

Graeme

ronburk

  • Community Member
  • Posts: 22
  • Hero Points: 3
Re: Editor Control on_change event
« Reply #5 on: September 06, 2006, 04:09:07 am »
Thanks for the additional tips!