kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #06287
Re: Escape key handling in dialog boxes.
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.
wxID_CANCEL is a nice solution, reusing a known value is a good idea.
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
Follow ups
References