← Back to team overview

kicad-developers team mailing list archive

Re: Escape key handling in dialog boxes.

 

On 3/14/2011 11:44 AM, Dick Hollenbeck wrote:
> On 03/14/2011 10:31 AM, Wayne Stambaugh wrote:
>> I discovered a problem that exists in quite a few of the dialog boxes in Kicad.
>>  It turns out that calling SetFocus() when initializing the dialog box to fix
>> the escape key behavior on Linux doesn't work unless there is a button defined
>> with wxID_CANCEL or you call SetEscapeId( MY_CUSTOM_ID ).  In fact, if you
>> don't do this, the escape key also doesn't work on Windows (and I'm guessing
>> OSX) either.  For future reference, anyone creating dialog boxes need to be
>> aware of this behavior which is documented in the wxDialog section of the
>> wxWidgets documentation.  I will fix the dialogs but we need to be aware of
>> this to prevent it from occurring again.
>>
>> Wayne
> 
> Suggest you add this to the UIpolicy.txt file.  Might be easier to find in
> the future.

I'll update UIPolicy.txt as part of the dialog fixes.

> 
> wxID_CANCEL is a nice solution, reusing a known value is a good idea.

This was what I was planning to do.  Interestingly, all of the dialogs I found
that have this problem do not use the standard dialog button sizer and have a
close or similar button with the ID defined as wxID_ANY.

Wayne

> 
> In general, the "scope" of a control ID should be considered.  We do this
> for variable names, we don't like globals.  Well we should not like global
> control ids either, each should be limited to the scope in which they are
> pertinent.
> 
> 
> Thanks,
> 
> Dick
> 
> 
> _______________________________________________
> 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
> 



References