cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX scroll list invalidate problem STM32H750B-DK

Aurentiaco
Associate III

Hello,

I am trying to make a wifi list using STM32H750B-DK. I designed my screen and add scroll list in it. I am receiving the wifi list from the esp32 and I want to show them on my list. I manage the copy it in my container but I got an issue. When I tried to invalidate it, it is not showing the wifi's until I scroll it down or up. Does anybody have an idea? 

 

void WiFiScreenView::wifiSSIDListUpdateItem(wifiSSIDContainer& item, int16_t itemIndex)
{
	if(isWiFiListReceived){
		item.refreshWiFi(itemIndex);
	}
	wifiSSIDList.invalidate();
}

 

Here is my update item code and wifiSSIDList is my scroll list not the container. And this is my container code.

 

void wifiSSIDContainer::refreshWiFi(uint8_t idx)
{
	const char* wifiName = WiFiList[idx];
	Unicode::strncpy(textWiFiNameBuffer, wifiName,TEXTWIFINAME_SIZE);
	textWiFiName.setWildcard(textWiFiNameBuffer);
	textWiFiName.invalidate();
}

 

 If anybody have an idea I am open to try it.

1 ACCEPTED SOLUTION

Accepted Solutions
t.decker
Senior II

The wifiSSIDListUpdateItem(...)-callback is only called when:

  • you scroll through your list and a DrawableListItem is coming into view and needs its content updated
  • you change the number of items in your ScrollList (and that may depend on how you resize the list and where the scroll-position is)
  • you call .itemChanged(...) of the offset of your wifi-list that changed.

If you don't know what changed (number of Wifis or their names or their order in your list), you can force an update to all items in your ScrollList by calling:

 

wifiSSIDList.setNumberOfItems(wifiCount);
for (int i = 0; i < wifiSSIDList.getNumberOfItems(); i++) {
	wifiSSIDList.itemChanged(i);
}
wifiSSIDList.invalidate();

 

See solution of this thread for some insight into index to DrawableItem vs. "WifiSSIDListIndex": https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-simulator-assertion-quot-timerwidget-registered-too/td-p/679316

When this account seems to be inactive, try @tdecker2 - ST can't change mail addresses, so I had to create a new account.

View solution in original post

5 REPLIES 5
hellohello
ST Employee

Hello @Aurentiaco ,

 

I assume your list is in the screen named WiFiScreen.

In the file WiFiScreenView.cpp, did you add anything in the initialize function?

I think that you should call something in it like for instance your wifiSSIDListUpdateItem function.

 

Regards,

Hello @hellohello 
This is my code there isn't any initialization function or code when I check the .hpp files. 

WiFiScreenView::WiFiScreenView() :
wifiSSIDList_ItemSelectedCallback(this, &WiFiScreenView::wifiSSIDList_ItemSelectedHandler)
{
	keyboard.setPosition(80,16,320,240);
	add(keyboard);
	keyboard.setVisible(false);
	keyboard.invalidate();
}
void WiFiScreenView::setupScreen()
{
	wifiSSIDList.setItemSelectedCallback(wifiSSIDList_ItemSelectedCallback);
    WiFiScreenViewBase::setupScreen();
	buttonBack.setVisible(true);
	buttonBack.invalidate();
	buttonRefresh.setVisible(true);
	buttonRefresh.invalidate();
	MQTT_TX("$WSRC","page/tanksetupadc", "JSON");
}
void WiFiScreenView::tearDownScreen()
{
    WiFiScreenViewBase::tearDownScreen();
}
void WiFiScreenView::RuntimeCheck()
{
	if(sleepCounter > 300 && powerSetting5minSelected){
		gotoSleepScreen();
	}
	if(connectedWifiFlag){
		wifiConnected.setVisible(true);
		wifiConnected.invalidate();
	}
	else{
		wifiConnected.setVisible(false);
		wifiConnected.invalidate();
	}
}
void WiFiScreenView::wifiSSIDListUpdateItem(wifiSSIDContainer& item, int16_t itemIndex)
{
	if(isWiFiListReceived){
		item.refreshWiFi(itemIndex);
	}
	wifiSSIDList.invalidate();
}

What do you suggest? This is my WiFiScreenView.cpp

hellohello
ST Employee

Yes, I forgot the name. I meant to say setupScreen().

 

Can you try to invalidate it in your setupScreen (doubt it would work but worth the try).

Can you try to scroll using the code (not actually touching the screen) with either

virtual void	animateToPosition(int32_t position, int16_t steps =-1)
    //Animate to a new position/offset using the given number of steps.

or

virtual void	animateToItem(int16_t itemIndex, int16_t animationSteps =-1)
    //Go to a specific item, possibly with animation.

 

@GaetanGodart 

t.decker
Senior II

The wifiSSIDListUpdateItem(...)-callback is only called when:

  • you scroll through your list and a DrawableListItem is coming into view and needs its content updated
  • you change the number of items in your ScrollList (and that may depend on how you resize the list and where the scroll-position is)
  • you call .itemChanged(...) of the offset of your wifi-list that changed.

If you don't know what changed (number of Wifis or their names or their order in your list), you can force an update to all items in your ScrollList by calling:

 

wifiSSIDList.setNumberOfItems(wifiCount);
for (int i = 0; i < wifiSSIDList.getNumberOfItems(); i++) {
	wifiSSIDList.itemChanged(i);
}
wifiSSIDList.invalidate();

 

See solution of this thread for some insight into index to DrawableItem vs. "WifiSSIDListIndex": https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-simulator-assertion-quot-timerwidget-registered-too/td-p/679316

When this account seems to be inactive, try @tdecker2 - ST can't change mail addresses, so I had to create a new account.
Aurentiaco
Associate III

@t.decker Thank you for your advice I tried it and it works fine.