Re: Signal Handler Block

"Vladimir V. Markevich" wrote:

I think this way will be perfect.
OK, I will add the code to do this in the next version. It will not
mean a great increase to the file and all will work as
before for any developer that doesn't need the functionality.

It would be great.  For example, I want have smart date entry,
when user type first two character of a data, it automaticly add the
separator such as '-', and so.
If I add signal handler on insert_text, it control user input
and after second character it must insert '-'. But in this case
insert_text handler do recursive call. That is undesirable.
If I know callback id I might block it on time inside insert_text call,
and unblock after that.
Perhaps it would be simpler to connect the handler to 'key_press_event'
'after' and not connect to the 'insert_text' signal at all.

The handler would have to check the $event->{'keyval'} to make sure that
it is acceptable (eg A-Z,a-z) so that Ctrl+L doesn't trigger any unwanted
changes but this also allows you to do some validation while the user is
still typing.

HTH, Dermot

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