cancel
Showing results for 
Search instead for 
Did you mean: 

Change scrollwheel content by a button in TouchGFX.

Karim
Associate II

Hi,

Is it possible to change the content of a scrollwheel by a button in the same screen.

For example I have 3 options Menu 1, Menu 2 and Menu 3 in scrollwheel when the screen appears for the firs time. I want to change these options to Menu 4 ~ Menu 6 by clicking a button in same screen.

Is there any other solution?

Thank you everyone.

1 ACCEPTED SOLUTION

Accepted Solutions
Ok then before invalidate add
scrollWheel1.itemChanged(1);
scrollWheel1.itemChanged(2);
scrollWheel1.itemChanged(3);

View solution in original post

8 REPLIES 8
MM..1
Chief II

you can do , what you need write into

scrollWheelUpdateItem(MenuElement& item, int16_t itemIndex)

thank you for your reply.

Yes I your are right and I already use it. I defined scrollWheelUpdateItem in screenview.cpp and it updates the content when change the screen from other screen to this screen.

But I want change the content by clicking a Button in current screen. (By defining an interaction for example)

Into button action place

markervariable=4;
scrollwhell.invalidate

and in

scrollWheelUpdateItem(MenuElement& item, int16_t itemIndex)
{
if (markervariable == 4)
 {
 
 }
else {
actual code or any other change what show
 
}
}

Thank you for your reply but unfortunately I still didn't get. Let me explain more.

this is in my ScreenSelectChannelView.cpp:

void ScreenSelectChannelView::scrollWheel1UpdateItem(TableContent& item, int16_t itemIndex)
{
    item.updateColumn1(itemIndex);
    item.updateColumn2(itemIndex);
 
    item.updateColumn4(presenter->getChannelName(Temp_Input_Index, itemIndex));
    touchgfx_printf("scrollWheel1UpdateItem\r\n");
}
void ScreenSelectChannelView::scrollWheel1UpdateCenterItem(TableSelectedRow& item, int16_t itemIndex)
{
    item.updateColumn1(itemIndex);
    item.updateColumn2(itemIndex);
 
    item.updateColumn4(presenter->getChannelName(Temp_Input_Index, itemIndex));
    touchgfx_printf("scrollWheel1UpdateCenterItem\r\n");
}

These 2 functions work correctly. They update my table when I change my screen from ScreenHome to ScreenSelectChannel. I have a button in ScreenSelectChannel. I want change the content of my table by pressing the button.

As I understand you say add this section:

if (markervariable == 4)
 {
 
 }
else {
actual code or any other change what show
 
}

to ScreenSelectChannelView::scrollWheel1UpdateItem and markervariable  = 4 in button action.

My problem is I don't know how to call scrollWheel1UpdateItem in button function? Or there is an other way that I don't know.

Sorry if my question is too easy.

Thank you.

In button you call
scrollWheel1.invalidate();

Thank you again for your fast replies. I searched a lot and so I don't have any way except asking here.

I already did what you say. This is my button action:

void ScreenSelectChannelView::setInputIndex1()
 
{
	Temp_Input_Index = 1;
 
	scrollWheel1.invalidate();
 
  touchgfx_printf("setInputIndex1 %d \r\n", Temp_Input_Index);
 
}

I expect calling function "scrollWheel1UpdateItem " by pressing the button but touchgfx_printf shows it doesn't run:0693W00000KbdWjQAJ.pngIn Red section we see scrollWheel1UpdateItem and scrollWheel1UpdateCenterItem are called when I change the screen to ScreenSelectChannel. But pressing buttons doesn't call those functions.

Thank you.

Ok then before invalidate add
scrollWheel1.itemChanged(1);
scrollWheel1.itemChanged(2);
scrollWheel1.itemChanged(3);

Oh, Yes it works.

Thank you so much.

Thank you.:hibiscus: