Re: Best practice query: Entry field "user's done editing" handling?



On Tue, Dec 24, 2013 at 9:14 PM, Nicola Fontana <ntd entidi it> wrote:
Il Mon, 23 Dec 2013 22:19:28 -0800 "A. Walton" <awalton gnome org> scrisse:

Frankly I don't see what's wrong with making it instant apply from the
description. Connect to the GtkEditable::changed signal, throw in a short
timeout that gets reset any time someone changes the field. If they have
stopped changing the field for more than some amount of time, say half a
second, then "commit the change" - do whatever you have to do with it
(validate it, send it to a server, write it to a file, etc.)

This is an excerpt directly taken from the doc you are pointing out:

"Do not attempt to validate or apply changes caused by editing a text
field control until the user has moved focus to a different control in
the window, or the window is closed. Validating after each keypress is
usually annoying and unnecessary. "

Definitely. In this case, validation means splitting the input string
into words, then translating each word into its canonical form (case
changes, but possibly also a complete change based on a server-side
database), and finally dropping anything that isn't correct. The last
one means that I absolutely can't validate a half-finished entry; the
others mean that validation implies traffic back to the server, so I
don't want to do it till the user's finished. Hence the waiting for a
focus change. I currently use focus-out-event, which means switching
to another window triggers it; what you describe there is what I'm
thinking of, but there doesn't seem to be a "validate" event.

ChrisA


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