22 May 2009 06:02
Re: Keys and focus handling
Ian Ward <ian <at> excess.org>
2009-05-22 04:02:24 GMT
2009-05-22 04:02:24 GMT
Fabian Braennstroem wrote: > Dear urwid users, > > I am starting to take a look at urwid after a quite long brake again... > so I am still a newbie> > I am a bit confused about the handling of button-press reactions and > setting focus using keys for different widgets. I attached a small > example. The aim is to show a help text or some more buttons on the > right green 'box' in the inner-frame as soon as I walk through the > buttons. The focused is set to the buttons, but as soon as I press one > of the buttons I would like to focus to the current content of the right > green column. > It would be nice, if anyone has a hint, how to achieve this!? You can use Column.set_focus() to move the focus to the right. It doesn't look like there's anything selectable in the right column right now, though. You should use a selectable widget, or at least a ListBox of unselectable widgets to handle user input when it takes the focus. Ian
>
> I am a bit confused about the handling of button-press reactions and
> setting focus using keys for different widgets. I attached a small
> example. The aim is to show a help text or some more buttons on the
> right green 'box' in the inner-frame as soon as I walk through the
> buttons. The focused is set to the buttons, but as soon as I press one
> of the buttons I would like to focus to the current content of the right
> green column.
> It would be nice, if anyone has a hint, how to achieve this!?
You can use Column.set_focus() to move the focus to the right.
It doesn't look like there's anything selectable in the right column right now,
though. You should use a selectable widget, or at least a ListBox of
unselectable widgets to handle user input when it takes the focus.
Ian
RSS Feed