How to detect Release of item of scrolllist ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 6:16 AM
I want work with scrolllist this way: touching and dragging -> scrolling the list of files, pressing (without drag) and releasing -> go to directory after releasing.
Question: how can i get Release event? Scrollist has onle 2 events - setItemSelectedCallback and setItemPressedCallback
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 7:00 AM
Try read this Workaround for swipe containers not swiping if dragged on a button within (st.com)
Or simpiy you need activate onclicklistener maybe not release
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 8:34 AM
Problem.....
If I create more than 9 files - system halts when I scroll list DOWN.
The program halts during the execution of scrollList1UpdateItem() that is called for no apparent reason. is this normal? I don't update the elements, but for some reason when scrolling down scrollList1UpdateItem is called.
Should it be called while scrollin DOWN?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 8:42 AM
scrollList1UpdateItem is called by system on every changes and need be writed as i show, reflect all values in itemIndex.
Please read how scrollist class work in reference ScrollList | TouchGFX Documentation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 9:15 AM
Hmm.. I didn't know, that scrollList1UpdateItem is called not for all items, but only for currently visible. If I scroll down, and new item must be shown, scrollList1UpdateItem called for it...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 10:18 AM
I found course of problem, but I don't know how fix...
Look...
I have scrollist with 8 visible items and 15 total items.
I change background of item when it pressed:
void STORAGE_SCREENView::scrollList1ItemPressedHandler(int16_t itemIndex)
{
(*FileList_Container*)scrollList1ListItems.getDrawable(itemPressed_old)).HighLightItem(false);
(*(FileList_Container*)scrollList1ListItems.getDrawable(itemIndex)).HighLightItem(true);
itemPressed_old=itemIndex;
if (itemIndex>2)
{
itemPressed_old=itemIndex;
}
}
if I delete strings
(*FileList_Container*)scrollList1ListItems.getDrawable(itemPressed_old)).HighLightItem(false);
(*(FileList_Container*)scrollList1ListItems.getDrawable(itemIndex)).HighLightItem(true);
problem disappears, if these strings a present, the problem (halt of system) is present too.
In "void STORAGE_SCREENView::scrollList1UpdateItem(FileList_Container& item, int16_t itemIndex)" all are simply - I can write "item.SetParam...."
But in void STORAGE_SCREENView::scrollList1ItemPressedHandler(int16_t itemIndex) I can't write "item", I need write (*(FileList_Container*)scrollList1ListItems.getDrawable(itemPressed_old)).HighLightItem(false);
How can I choose item to give with him "HighlightItem()" ?
How can I get link (pointer, handler) to Item, not only it itemIndex?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 10:43 AM
stop use getDrawable , this isnt right way to work with objects in list.
All changes you need do in update function and in others you need call
sel=false;
scrollList1.itemChanged(itemPressed_old);
sel=true;
scrollList1.itemChanged(itemIndex);
itemChanged force call STORAGE_SCREENView::scrollList1UpdateItem , and here you call
item.HighLightItem(sel);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-20 11:04 AM
Good... System don't halts.
But
item.HighLightItem(sel);
is called every time when UpdateItem is called, even without itemChanged(itemIndex) (without pressed event)
Hm..... may be I must to set number of selected Item, when scrollList1ItemPressedHandler() is called, and check it in scrollList1UpdateItem()...
I'll try....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-21 12:58 PM
Hello! You write
the scrollList1.itemChanged(itemIndex) function does not call scrollList1UpdateItem if the item with the itemIndex number is outside the scroll window. How to fix it?
You maybe mean olditem, because itemIndex is on Display when is clicked or managed. Yes olditem maybe is outside and call to update is skipped, but you need write code with some defaults or bool logic in update and all show as needed when scrolled back.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-12-21 1:01 PM
Thank you, I already guessed it 10 minutes after writing the post
