Skip to main content
DMane
Associate
July 14, 2019
Question

Overwriting of numbers when counter is increment or decrement

  • July 14, 2019
  • 13 replies
  • 2475 views

Counter is increment or decrement by pressing button the initial value is remain on text​ box and new value is overwrite on previous value. How to solve overwriting issue. 

This topic has been closed for replies.

13 replies

Anders Nedergaard PETERSEN
Senior II
July 15, 2019

Please ensure that you have invalidated the text widget after modifying the content of the buffer.

 // Update tick text and invalidate text area,
 // which will result in it being redrawn.
 Unicode::snprintf(tickTxtBuffer, 5, "%d", tick);
 tickTxt.invalidate();

You could also have a look at our Text Example UI available from the TouchGFX Designer as an UI Template

DMane
DManeAuthor
Associate
July 17, 2019
Thanks for your suggestion but I have already done this process but still I gating the overwriting issue so kindly suggest any other method to solve my issue.
Anders Nedergaard PETERSEN
Senior II
July 17, 2019

Hi @DMane​,

I understand your issue correct, it is when increasing or decreasing a number on screen, digits some times remain?

It might help by taking a look at the Button Example from the TouchGFX Designer.

/Anders

Anders Nedergaard PETERSEN
Senior II
July 31, 2019

Hi @DMane​,

Please see this forum post on how to interface between hardware and the UI (TouchGFX)

https://community.st.com/s/question/0D50X0000AU4zodSQB/interfacing-with-hardware-in-touchgfx-applications

With the Designer you can add an interaction to a button which will then do a screen transition. Have a look at the code in the generated folder:

In generated/gui_generated/include/gui_generated/common/FrontEndHeapBase.hpp you will now see that a slidetransition has been added to the list of "GeneatedTransitionTypes".

 /**
 * A list of all transition types. Must end with meta::Nil.
 * @note All transition types used in the application MUST be added to this list!
 */
 typedef meta::TypeList< NoTransition,
 meta::TypeList< SlideTransition<EAST>,
 meta::Nil >
 > GeneratedTransitionTypes;

Now lets have a look at the FrontendApplicationBase.hpp (generated/gui_generated/include/gui_generated/common/FrontendApplicationBase.hpp)

here we see that function prototypes to to the transition have been added, the "void gotoScreen2ScreenSlideTransitionEast();" and "void gotoScreen2ScreenSlideTransitionEastImpl();"

The implementation of these are found in generated/gui_generated/src/common/FrontendApplicationBase.cpp

void FrontendApplicationBase::gotoScreen2ScreenSlideTransitionEast()
{
 transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoScreen2ScreenSlideTransitionEastImpl);
 pendingScreenTransitionCallback = &transitionCallback;
}
 
void FrontendApplicationBase::gotoScreen2ScreenSlideTransitionEastImpl()
{
 makeTransition<Screen2View, Screen2Presenter, touchgfx::SlideTransition<EAST>, Model >(&currentScreen, &currentPresenter, frontendHeap, &currentTransition, &model);
}

Please take a look at the attached files, here the transition is done by adding the same scheme to the FrontendHeap.cpp and FrontendApplication.cpp placed in the gui folder.

I hope this helps

/Anders