2023-08-21 12:13 PM - last edited on 2023-08-25 03:16 AM by Osman SOYKURT
hi all, I need to highlight an item in a scrolllist using two buttons that start scrolling up and down. I managed to implement the routine but I have problems as soon as the system passes into the area of the list that is not yet displayed.
Does anyone have any advice? these are the two code elements that allow the transition with simplicity (even if not 100% functional)
void ProdManagerScreenView::shiftCurrentDrowerUp(void){
if(selectedDrowerItem>0){
selectedDrowerItem--;
HighlItem--;
scrollList10.animateToItem(selectedDrowerItem,-1);
clearDrowerSelection();//THIS CLEAR OLD SELECTED
HilightLineDrowerSelection(0,HighlItem);//HIGHLIGHT NEW ONE
scrollList10.invalidate();
//scrollList10.initialize();
}//
}
//
void ProdManagerScreenView::shiftCurrentDrowerDw(void){
selectedDrowerItem++;
if(selectedDrowerItem<scrollList10.getNumberOfItems()){
HighlItem++;
//SE SI, ANIMA TUTTO IN PASSI DI 1
scrollList10.animateToItem(selectedDrowerItem,-1);
//scrollList10.initialize();
clearDrowerSelection();//THIS CLEAR OLD SELECTED
HilightLineDrowerSelection(0,HighlItem);//HIGHLIGHT NEW ONE
scrollList10.invalidate();
//scrollList10.initialize();
} else{
selectedDrowerItem--;
}
}
//
2023-09-01 05:45 AM
Hello @Msolinas ,
I suggest using Scroll Wheel instead of Scroll List because it already has the functionality to focus on one item or in your case, to highlight it. Also, you need to make your Scroll List or Scroll Wheel large enough to accommodate all the elements that you need. It doesn't matter if the list grows out of the screen.
You can read more about Scroll Wheel here:
https://support.touchgfx.com/docs/development/ui-development/ui-components/containers/scroll-wheel
I hope this will help you