Re: Listbox key bindings not working as expected
"Raman.P" <[email protected]> Fri, 13 Aug 2010 02:03:28 -0700 (PDT)
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
--- On Fri, 13/8/10, Rainer J.H. Brandt <[email protected]> wrote: > From: Rainer J.H. Brandt <[email protected]> > Subject: Listbox key bindings not working as expected > To: [email protected] > Date: Friday, 13 August, 2010, 2:19 PM > Hello, > = > the Tk::Listbox man page says: > = > =A0 =A0 "[5] If the Up or Down key is pressed, the > location cursor > =A0 =A0 =A0 =A0=A0=A0(active element) > moves up or down one element.=A0 If the > =A0 =A0 =A0 =A0=A0=A0selection mode is > browse or extended then the new active > =A0 =A0 =A0 =A0=A0=A0element is also > selected and all other elements are > =A0 =A0 =A0 =A0=A0=A0deselected.=A0 In > extended mode the new active element > =A0 =A0 =A0 =A0=A0=A0becomes the > selection anchor." > = > However, when I select one element with button one, and > then use > the Up and Down keys, nothing happens at all. > Use this script to reproduce the problem: > = > use Tk; > $mw =3D MainWindow->new(); > $lb =3D $mw->Listbox()->pack(); > $lb->insert('end', 1..5); > MainLoop; > = > I've tried with 804.029 under Perl 5.12.1 on recent > Solaris > and OS X versions.=A0 I've verified that the keys are > recognized as > Up and Down.=A0 Do you have any advice? key bindings will work only when keyboard focus is on the widget. Try setti= ng focus like this use Tk; $mw =3D MainWindow->new(); $lb =3D $mw->Listbox()->pack(); $lb->insert('end', 1..5); $lb->focus(); MainLoop; Raman.P blog:http://ramanchennai.wordpress.com/ --++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--+= +**=3D=3D ptk mailing list [email protected] https://mailman.stanford.edu/mailman/listinfo/ptk