← Back to team overview

kicad-developers team mailing list archive

Re: Dialog field validation on KillFocus


On 11/29/18 2:36 PM, Jeff Young wrote:
> While most UI guidelines suggest validating on field exit, it’s not without cost.  In particular, on GTK we can’t tell the difference between a KillFocus from clicking the OK button (when validation should be run) and a KillFocus from clicking Cancel (when it should not).  
> Needless to say, KillFocus-validation also plays very poorly when GTK’s focus-follows-mouse is turned on.
> So I plan to do two things:
> 1) Remove automatic validation on KillFocus from UNIT_BINDER.  Clients which need validation will be modified to call Validate() themselves from their TransferDataFromWindow() methods.
> 2) Remove UNIT_BINDER validation which isn’t needed.  We have a lot of validation which just checks for “reasonable” values.  However, our definition of “reasonable” doesn’t always match our users’ definitions.  “Needed” validation (which will remain) is that which prevents un-supported situations, or that which makes recovery hard (for instance, PCB text with a zero width is hard to select).
> Any comments before I go ahead?

Hi Jeff,

John Beard had a good idea of replacing an error pop-up dialog with an
error indicator (red frame around text or red background for text input
widget). It will notify the user about potential problems without being
too disruptive, and such check might be done by KillFocus event handler.

I would still keep a pop-up dialog showing up if the user wants to
accept invalid settings (call Validate() in TransferDataFromWindow()).
If we want to provide ammo to shoot their feet, then 'Ignore' button
sounds like an appropriate caliber.


Attachment: signature.asc
Description: OpenPGP digital signature

Follow ups