SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: ronburk on September 02, 2006, 05:22:49 PM

Title: Editor Control on_change event
Post by: ronburk 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?
Title: Re: Editor Control on_change event
Post by: gary_ash 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?
Title: Re: Editor Control on_change event
Post by: ronburk 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.
Title: Re: Editor Control on_change event
Post by: gary_ash 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
Title: Re: Editor Control on_change event
Post by: Graeme 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
Title: Re: Editor Control on_change event
Post by: ronburk on September 06, 2006, 04:09:07 AM
Thanks for the additional tips!