kba / lanterna

Automatically exported from code.google.com/p/lanterna
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Button is not focusable / clickable inside Panel #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See test case in attachment.

You can click or focus on Button object, if there are only Button object inside 
panels and there is no Button object directly added to Window object. When 
there is Button object added directly to Window object, then all buttons 
(including those inside Panel) are working as expected.

Using: lanterna-2.1.7 on Mac OS X 10.9.1

Original issue reported on code.google.com by ilmars.p...@gmail.com on 27 Dec 2013 at 5:29

Attachments:

GoogleCodeExporter commented 9 years ago
Correction: You CAN'T click or focus on Button object...

Original comment by ilmars.p...@gmail.com on 2 Jan 2014 at 1:28

GoogleCodeExporter commented 9 years ago
If you add the button to the panel before adding the panel to the window, it 
will work. When you add the empty panel to the window, it's looking for 
something to set focus on, but since the panel is empty, there is nothing. Then 
when you add the button to the panel, the window doesn't know about it so you 
either need to call setFocus(..) or add another component to make it scan again.

I've added some code to deal with this on 2.1.x-branch, now it will detect a 
window doesn't have anything in focus and scan the components.

Original comment by mab...@gmail.com on 16 Feb 2014 at 7:27