Ticket #18 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

can't get focus in grid

Reported by: bug_hunter@… Owned by: ian
Priority: minor Milestone: Urwid 0.9.8
Component: input_handling Version:
Keywords: Cc:

Description

Hello. This construction can't get focus to urwid.Edit.

import urwid as u

...

u.Columns( [
    u.Text("HABA", align='left'),
    u.AttrWrap( urwid.Edit(  ('editcp',"test"), "666.66.66.66/24" ), 'editbx', 'editfc'  ),
    ]),

...

But this works great:

u.Columns( [
    u.AttrWrap( urwid.Edit(  ('editcp',"test"), "666.66.66.66/24" ), 'editbx', 'editfc'  ),
    u.AttrWrap( urwid.Edit(  ('editcp',"test"), "666.66.66.66/24" ), 'editbx', 'editfc'  ),
    ]),

Sorry if i'm not right.

Change History

Changed 6 years ago by ian

  • status changed from new to closed
  • resolution set to wontfix

Try:

u.Columns( [
    u.Text("HABA", align='left'),
    u.AttrWrap( urwid.Edit(  ('editcp',"test"), "666.66.66.66/24" ), 'editbx', 'editfc'  ),
    ], focus_column=1),

Explanation: Composite widgets (like Columns) don't search for selectable widgets they contain, you have to tell them which widget you want in focus. They default to the first item, and if it isn't selectable then the whole composite widget won't be selectable.

I'll try to document this better.

Changed 6 years ago by ian

  • priority changed from major to minor
  • status changed from closed to reopened
  • resolution wontfix deleted

On second thought, the default behaviour is counterintuitive.

I should make the default behaviour for Columns, Pile and ListBox "select the first selectable widget" when they are created.

Changed 6 years ago by ian

  • milestone set to Urwid 0.9.8

Changed 6 years ago by ian

  • status changed from reopened to closed
  • resolution set to fixed

Fixed in r99.

Note: See TracTickets for help on using tickets.