mettli / guichan

Automatically exported from code.google.com/p/guichan
Other
0 stars 0 forks source link

Dropdown control: selecting with arrow keys when dropdown is open skips items #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. compile and run the sdlwidgets demo
2. click the dropdown so that it opens and you can see all items (zero,
one, two, three, four)
3. press the down arrow

one would expect the selected item to move from zero to one, but instead it
skips one and moves to two.  This doesn't happen if the dropdown is closed
however.

This is with guichan 8.1, though I've seen the behavior with earlier
versions (just didn't look into it until now and realize it wasn't a bug in
my own code).  I'm running Ubuntu Linux, 64 bit, SDL backend.

Original issue reported on code.google.com by holomo...@gmail.com on 7 Jun 2008 at 12:56

GoogleCodeExporter commented 9 years ago
The problem was that when the down key was pressed the list box inside the drop 
down
received an event as well as the drop down causing the second item to be 
skipped. It
was solved by letting the drop down ignore all consumed key events.

Original comment by olof.nae...@gmail.com on 6 Aug 2008 at 12:12

GoogleCodeExporter commented 9 years ago
Why does the DropDown receive a consumed event in the first place?

Original comment by b.lindeijer on 8 Aug 2008 at 10:06

GoogleCodeExporter commented 9 years ago
Besauce DropDown is a BasicContainer containing a ListBox. When the DropDown is
folded down, the ListBox inside DropDown requests focus. As all key events 
bubbles up
from the source, DropDown receives all events from ListBox and thus should 
ignore any
events that are consumed. So the fix is actually the correct behaviour of 
DropDown. 

What one should ask is why didn't the incorrect behaviour cause more problems 
as all
events should be received by the DropDown and not just the first one?

Original comment by olof.nae...@gmail.com on 8 Aug 2008 at 10:18

GoogleCodeExporter commented 9 years ago
No, what I meant to ask was, if the ListBox has consumed the event, why does the
DropDown still receive it? I know events bubble up, but shouldn't the bubbling 
up
stop once the event is consumed? Cause if it doesn't, you'll have to check 
isConsumed
in a lot of places, since you really shouldn't be dealing with consumed events.

Original comment by b.lindeijer on 20 Aug 2008 at 12:57

GoogleCodeExporter commented 9 years ago
That's just the way Guichan works, all events keep bubbling up no matter what, 
they
are simply marked as consumed.

Perhaps events could stop bubbling up, but I need to think about that for a 
while to
make sure there aren't any situations where you want to receive events no 
matter what.

Original comment by olof.nae...@gmail.com on 20 Aug 2008 at 2:29