Reverse Listview "index"

Hi.
New to App Inventor and enjoying it so far. I've got a problem I was hoping to solve, but it's been driving me nuts trying to figure out..

I've created a text input section with "Name, Message and Date" which then show up in a listview. I have it set to show in reversed order so the newest message show at the top of the list. So far so good....

The problem comes when I try to delete one of the messages from the list as it deletes the "opposite" one. If I delete the one at the bottom, the one at the top gets deleted. It's as if the "index" isn't reversed along with the list...

Hope I made any sense with this explanation. Any ideas how to solve this problem??

If needed I'll post the blocks used for creation.

Please do so :wink:

1 Like

All depends on how you are setting this in the listview. Are you using the reverse list block before setting in the listview or some other method?

Here are the three section of blocks used. Seems like I've put "reverse list" everywhere... :slight_smile: :laughing:. Any pointers in the right direction or solution would be greatly appreciated.

Keep in mind I'm practically a "virging coder...." :slight_smile: :smiley:

1 Like

Direct solution:
When removing, do

length of list - selection index + 1

Well, it's everywhere :laughing: I probably keep reversing the listview over and over again.. I've tried in different sections of blocks and gotten various results..

I probably should have read through tons of publications about App Inventor, but this is usually how I do things (in the wrong order...)

I believe you want to insert a new item in the first index?
If yes, remove all the reverse list block, and replace add item to list with insert item

Everything is the same except the index will be one.

I'm not sure I'm following all this, but yes every entry should end up first in the list which they do. Perhaps this is well over my head... but it bugs me everything is working except for deleting the "right" selected item.

How and where exactly do I use the "length of list - selection index + 1"? I assume the Notifier block? Sorry for being such a newbie..

1 Like

Correct, it should be the index for removing item from the list

1 Like

So this is practically the listview from hell and it will haunt me... I've gotten it to at least delete the entry above the one I select (which is an improvement :slight_smile:) and not the opposite end of the list like before...

I'll keep tinkering with it a bit to see if I can figure something out or scrap the project all together.

Thank you so much for your effort in trying to help me out. I probably don't have enough knowledge yet.

Simply add last item to first position in list, no need for any reversing:

image

2 Likes

Wow!! It worked!! Thank you so much (both of you) :smile: This really really made my day! YAHOOO!!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.