Re: Gtk Focus chain

On Wed, Mar 14, 2007 at 10:53:08AM +0530, Varun Singla wrote:
> -----------------------------------
> |        |______1_____ |           |
> |        | textentry   |           |
> |   2    |_____3______ |    4      |                          Diagram - 2
> |________|_______5_____|___________|
> ...
> Now in diagram-2, if initially the focus is on widget 3 (textentry), and we
> press TabBackward, the focus goes to widget 1... This behaviour is logically
> correct considering the packing of the widgets; but its physically incorrect
> as TabBackward should first move the focus on the left widget considering
> the chain....But widget 1 is above widget 3 , so considering the physical
> positions of the widgets in the window, the focus is going to widget-1,
> though it should have gone to widget-2

Why?  If I consider the physical positions I have to
conclude Gtk+ gets it right.

The focus chain chosen by Gtk+ here always moves focus
physically left or up on TabBackward and physically right or
down or TabForward, and it never moves it the wrong

Tell us what the *complete* focus chain should be according
to you, then we can compare which one makes more sense.  If
it's something like 1->2->3->4->5 that moves the focus twice
the physically wrong direction (1->2 and 4->5) there should
be no doubts about the superiority of the default Gtk+ focus

> Similar kind of difference in focus movement can be seen with TabForward
> also... So I want to remove this kind of discrepancy with the TabForward and
> TabBackwad movement, by creating another focus chain based on the physical
> locations of the widgets.

The behaviour is consistent with regard to physical
locations here.

> Please tell me how to proceed, and if there is any api for this
> functionality.

There is no API for that, there is only an API for changing
the focus chain inside containters.  And if I may suggest
how to proceed: don't.  If your containers make sense, so
should the focus chain.  For instance here:

  Header 1          Header 2
  () Radio 1.1      () Radio 2.1
  () Radio 1.2      () Radio 2.2
  () Radio 1.3      () Radio 2.3
  () Radio 1.4      () Radio 2.4

the focus should move by group, not by row (physically),
which implies the preferred packing.  If your containers
don't make any sense with regard to grouping you can as well
use GtkLayout to place the widgets and then you can set the
focus chain with the standard API.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]