Clicking in empty part of list highlights first item

25 views
Skip to first unread message

Timo van de Put

unread,
Feb 27, 2014, 12:05:34 PM2/27/14
to codenameone...@googlegroups.com
I have a Form with a borderlayout, and the List is occupying the center.
The List has a custom ListCellRenderer with a Label as ListFocusComponent.
There are a few items, leaving some empty space below them in the list.

When I click in this empty space, the first item is highlighted (but luckily not selected).

How can I prevent this selection from happening?

Shai Almog

unread,
Feb 27, 2014, 2:56:46 PM2/27/14
to codenameone...@googlegroups.com
Do you derive from the native theme?
Did you change any theme constants?
Does your renderer respect the selected state properly?
If you use a default list cell renderer does it do that?

Timo van de Put

unread,
Feb 28, 2014, 3:28:13 AM2/28/14
to codenameone...@googlegroups.com
Hi Shai,

I found the cause: I misunderstood the purpose of getListFocusComponent() method of ListCellRender.

My intention was to have a List confirm selection of an item by providing a focus component.
Although this did result in the desired effect, the actual purpose of this component is to allow for keyboard navigation.
In this context it makes sens that clicking below the list places focus on the first item.

Sorry to have wasted your time.
Reply all
Reply to author
Forward
0 new messages