Where to bind on_selection_change to ListAdapter in kv

36 views
Skip to first unread message

rick

unread,
Jan 19, 2017, 10:06:12 AM1/19/17
to Kivy users support
In the following kv section: 

TabbedPanelItem:
        id: tab2
        text: 'VIEW'
        on_press: root.viewInit()
        ListView:
            id: view_list
            adapter: 
                ListAdapter(
                data= root.valid_views,
                selection_mode='multiple',
                allow_empty_selection=True,
                cls=ListItemButton)

Where do I insert "on_selection_change: root.somefunc()" to bind and catch the selection change event in ListAdapter? 

Oon-Ee Ng

unread,
Jan 19, 2017, 11:41:38 PM1/19/17
to kivy-...@googlegroups.com
That's not valid kv, I think. Here's it cleaned up. You could probably
put on_selection_change right there too (I've not used ListView in
ages so not very sure, RecycleView is preferred for a while now
anyway).

On Thu, Jan 19, 2017 at 11:06 PM, rick <ricksa...@gmail.com> wrote:
> In the following kv section:
>
> TabbedPanelItem:
> id: tab2
> text: 'VIEW'
> on_press: root.viewInit()
> ListView:
> id: view_list
> adapter:
> ListAdapter:
> data: root.valid_views
> selection_mode:'multiple'
> allow_empty_selection:True
> cls:ListItemButton
>
> Where do I insert "on_selection_change: root.somefunc()" to bind and catch
> the selection change event in ListAdapter?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kivy-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages