cancel
Showing results for 
Search instead for 
Did you mean: 

scrollList HighLight scrolling item

Msolinas
Senior

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--;
    }
}
//
 
1 REPLY 1

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

Mohammad MORADI
ST Software Developer | TouchGFX