|
From: Bryan O. <oa...@ba...> - 2006-05-24 13:49:43
|
Joe English wrote:
> [ Just catching up with the discussion ... ]
>
> Bryan Oakley wrote:
>
>
>>I noticed that with tile 0.7.2, if I click on a button the focus is set
>>to that button. Investigating I see it is due to this:
>>
>>% bind TRadiobutton <1>
>> %W instate !disabled { tile::clickToFocus %W; %W state pressed }
>>
>>Is this an intentional deviation from the standard widget behavior? The
>>normal tk widgets don't get focus when you click on them.
>
>
> Yes, that's intentional; and thanks for bringing this up --
>
> I checked the other major toolkits to see which ones use click-to-focus:
> Gtk, Windows, Motif, Mozilla, and OpenOffice all set focus-on-click for
> radio-, check-, and push-buttons; whereas Tk, Qt, and the Mac do not.
>
> Tile buttons set focus-on-click by default, though this can be
> disabled by setting '-takefocus 0' on the widget (see tile::clickToFocus
> and tile::wantsFocus in library/utils.tcl).
Setting -takefocus to zero is definitely not the right solution. We
don't want to completely remove the ability to traverse the widgets with
the keyboard, which is what -takefocus 0 does. I just don't want a click
on a radiobutton, checkbutton or tool button on my toolbar to steal
focus away from the main data entry area of my application.
As it stands today, the only way to get the behavior I want is to
completely override the class bindings. This is not a particularly good
solution either.
What we need is a separate option that specifies whether a click will
give focus. Yet, we already have a mechanism to do that -- bind
.whatever <1> {focus %W}.
|