Ian Ward | 22 May 2009 06:02
Favicon
Gravatar

Re: Keys and focus handling

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
Fabian Braennstroem | 22 May 2009 18:36
Picon
Picon

Re: Keys and focus handling

Hi Ian,

Ian Ward wrote:
> 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.

Yes, thanks for the hint. I am not sure, what the name of the small 
program was, but I already saw, some urwid code lines, with two columns, 
where the right column changed according to the position of the cursor 
on the left. Does anyone know the link for this urwid-program? Would be 
nice!

> 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.

(Continue reading)

Fabian Braennstroem | 23 May 2009 10:24
Picon
Picon

Re: Keys and focus handling

Hi,

me again ...

Fabian Braennstroem wrote:
> Hi Ian,
> 
> 
> Ian Ward wrote:
>> 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.
> 
> Yes, thanks for the hint. I am not sure, what the name of the small 
> program was, but I already saw, some urwid code lines, with two columns, 
> where the right column changed according to the position of the cursor 
> on the left. Does anyone know the link for this urwid-program? Would be 
> nice!
(Continue reading)


Gmane