← Back to team overview

kicad-developers team mailing list archive

Re: Dialog field validation on KillFocus

 

On 11/29/2018 8:47 AM, Maciej Sumiński wrote:
> 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.

This way is known to work well across platforms.  Anything else and your
at the mercy of platform specific event ordering and other UI toolkit
quirks.

>>
>> 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.

This would be more tolerable than a dialog but a red frame may not work
well with all WM themes.

> 
> 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.

You may want to tread carefully allowing users to accept invalid
settings.  They may cause crashes or other unexpected behavior bugs.

> 
> Cheers,
> Orson
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References