how to clear listview selection?

1,292 views
Skip to first unread message

Mangesh

unread,
Jan 18, 2016, 12:32:41 AM1/18/16
to MIT App Inventor Forum
I've searched online including this forum, but I'm not able to find the answer to this.

I have a listview. Once selected, there's a showTextDialog that occurs. However, when you click cancel, I don't want anything to be selected... I tried changing the selectionIndex to 0 but that didn't work.

Current behavior: when you click cancel, it still highlights the item you clicked on initially

How do I unselect the element?

Taifun

unread,
Jan 18, 2016, 9:43:40 AM1/18/16
to MIT App Inventor Forum
the listview component is limited, you might want to use a Spinner instead, see also https://groups.google.com/d/msg/mitappinventortest/elurVKDJL9o/t9OQt8l5CgAJ
Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Abraham Getzler

unread,
Jan 18, 2016, 11:11:16 AM1/18/16
to MIT App Inventor Forum
You can't just add a prompting element at slot 1 of the selection list,
like "Pick a card"  and use index 1 for the not-selected option?
ABG

Mangesh

unread,
Jan 18, 2016, 11:34:39 AM1/18/16
to MIT App Inventor Forum
Thank you Taifun. It's a bit interesting. From the AI website:

SelectionIndex
The index of the currently selected item, starting at 1. If no item is selected, the value will be 0. If an attempt is made to set this to a number less than 1 or greater than the number of items in the ListView, SelectionIndex will be set to 0, and Selection will be set to the empty text.

Is this a bug or am I misintrepreting the above statement?

If I wanted to request this as a feature, where would I submit that?
Message has been deleted

supermango

unread,
Jan 18, 2016, 12:16:06 PM1/18/16
to MIT App Inventor Forum
I got this to work...

You set the elements back to the listview and this clears the selection:

Abraham Getzler

unread,
Jan 18, 2016, 12:53:04 PM1/18/16
to MIT App Inventor Forum
Nice and simple.
Added to my FAQ
ABG
Reply all
Reply to author
Forward
0 new messages