[haiku-commits] Re: haiku: hrev47179 - src/kits/interface

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 29 Apr 2014 00:34:14 +1200

On 28 April 2014 23:07, Stephan Aßmus <superstippi@xxxxxx> wrote:
> Hi,
>
> Am 28.04.2014 12:53, schrieb jessica.l.hamilton@xxxxxxxxx:
>
>> 273109e: Fix window behavior when default button is present
>>
>>    * Don't intercept Enter key press in a window when there is default
>>    button and another BControl focused.
>>    * Current behavior was basically breaking every window using default
>>    button. Even if there was a button focused (using Tab key), when Enter
>>    was hit, default button handled the message, therefore instead of
>>    i.e. 'Revert' 'Apply' was pressed.
>>    * Fixes #10792.
>>
>>    Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
>
>
> [...]
>
>
>>                         if (DefaultButton() != NULL
>> +                               && dynamic_cast<BControl*>(CurrentFocus())
>> == NULL
>>                                 && message->FindInt32("raw_char",
>> &rawChar) == B_OK
>>                                 && rawChar == B_ENTER)
>>                                 return DefaultButton();
>
>
> First of all, I agree the previous behavior was irritating. It immitated
> BeOS: The idea seemed to be that SPACE operates controls such as checkmarks,
> radio buttons and also regular buttons, not ENTER. So in BeOS, to invoke a
> button other than the default button, you had to tab-cycle to it to give it
> focus, then press SPACE. ENTER always invoked the default button. I remember
> at least one situation where it irritated me.
>
> But with how you changed it, what happens now when you have a simple dialog
> with a text control "Name" and two buttons "Cancel" and "OK": You type
> somthing in the Name field, hit ENTER and nothing happens, because the Name
> field has focus. Previously, the OK default button would be invoked.
>
> I don't know if this would work in all cases, but I would dynamic_cast to
> BButton. BButton is something that represents a direct action, while other
> controls only represent options or properties that can be toggled or
> modified. So this could be a solution that would perhaps work well in
> practice, unless I missed something when thinking this through.

I did think about the fact it was a BControl... however, in my
testing, it didn't seem to cause issues.

I tested it with the Screen Preferences preflet, and when a text
control was focused, ENTER still invoked the default button; if you
have a simpler example that doesn't work, I will have a closer look.

Jessica

Other related posts: