Skip to main content
mchin.1
Associate II
November 13, 2021
Question

How to change screen with touchgfx api functions with out interactions?

  • November 13, 2021
  • 17 replies
  • 4631 views

I am working on touchgfx LCD. I need a a support to develop our custom application.

i have seen touchgfx API functions setup screen but i need example for better understanding.

This topic has been closed for replies.

17 replies

MM..1
Super User
November 13, 2021
application().gotoXXXXXScreenNoTransition();

mchin.1
mchin.1Author
Associate II
November 13, 2021

Thank you but i have seen below information

switchScreen

virtual void switchScreen(Screen *newScreen)Switch to another Screen.Will call tearDownScreen on current Screen before switching, and subsequently call setupScreen and draw automatically for the new Screen.Parameters:newScreenA pointer to the new screen.

how can i use this to switch from one screen to other

virtual void switchScreen(Screen *newScreen)

mchin.1
mchin.1Author
Associate II
November 13, 2021

I am not getting this gotoScreen5ScreenNoTransition() in application.gotoScreen5ScreenNoTransition(); with out interaction.

I do not want to add interaction so at that time what should i do for screen change ?

MM..1
Super User
November 13, 2021

I dont check 4.18 , but every screen have in application Base generated NoTransition goto. Check it. Interaction dummy you need only for animated transition changes.

mchin.1
mchin.1Author
Associate II
November 13, 2021

I am using 4.17.0 Base generated NoTransition goto not generated when add screen only

but generated whenvever adding screen change interaction

MM..1
Super User
November 13, 2021

You check file FrontendApplicationBase.cpp?

mchin.1
mchin.1Author
Associate II
November 13, 2021

yes

i checked that file

not generated Base generated NoTransition in FrontendApplicationBase.cpp if i just add screen simply.

so How can i change screen with out this application().gotoXXXXXScreenNoTransition();. finally i got a error.

MM..1
Super User
November 13, 2021

I have only one no empty screen in app no interactions and file in v 4.17

/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <new>
#include <gui_generated/common/FrontendApplicationBase.hpp>
#include <gui/common/FrontendHeap.hpp>
#include <touchgfx/transitions/NoTransition.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include <touchgfx/Texts.hpp>
#include <touchgfx/hal/HAL.hpp>
#include <platform/driver/lcd/LCD16bpp.hpp>
#include <gui/screen1_screen/Screen1View.hpp>
#include <gui/screen1_screen/Screen1Presenter.hpp>
 
using namespace touchgfx;
 
FrontendApplicationBase::FrontendApplicationBase(Model& m, FrontendHeap& heap)
 : touchgfx::MVPApplication(),
 transitionCallback(),
 frontendHeap(heap),
 model(m)
{
 touchgfx::HAL::getInstance()->setDisplayOrientation(touchgfx::ORIENTATION_LANDSCAPE);
 reinterpret_cast<touchgfx::LCD16bpp&>(touchgfx::HAL::lcd()).enableTextureMapperAll();
}
 
/*
 * Screen Transition Declarations
 */
 
// Screen1
 
void FrontendApplicationBase::gotoScreen1ScreenNoTransition()
{
 transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoScreen1ScreenNoTransitionImpl);
 pendingScreenTransitionCallback = &transitionCallback;
}
 
void FrontendApplicationBase::gotoScreen1ScreenNoTransitionImpl()
{
 touchgfx::makeTransition<Screen1View, Screen1Presenter, touchgfx::NoTransition, Model >(&currentScreen, &currentPresenter, frontendHeap, &currentTransition, &model);
}

mchin.1
mchin.1Author
Associate II
November 13, 2021

i am checking Screen Transition Declarations in FrontendApplicationBase.cpp ..Is it right?

mchin.1
mchin.1Author
Associate II
November 13, 2021

/*********************************************************************************/

/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/

/*********************************************************************************/

#include <new>

#include <gui_generated/common/FrontendApplicationBase.hpp>

#include <gui/common/FrontendHeap.hpp>

#include <touchgfx/transitions/NoTransition.hpp>

#include <texts/TextKeysAndLanguages.hpp>

#include <touchgfx/Texts.hpp>

#include <touchgfx/hal/HAL.hpp>

#include <platform/driver/lcd/LCD16bpp.hpp>

#include <gui/screen1_screen/Screen1View.hpp>

#include <gui/screen1_screen/Screen1Presenter.hpp>

#include <gui/screen2_screen/Screen2View.hpp>

#include <gui/screen2_screen/Screen2Presenter.hpp>

#include <gui/screen3_screen/Screen3View.hpp>

#include <gui/screen3_screen/Screen3Presenter.hpp>

#include <gui/screen4_screen/Screen4View.hpp>

#include <gui/screen4_screen/Screen4Presenter.hpp>

#include <gui/screen5_screen/Screen5View.hpp>

#include <gui/screen5_screen/Screen5Presenter.hpp>

#include <gui/screen6_screen/Screen6View.hpp>

#include <gui/screen6_screen/Screen6Presenter.hpp>

#include <gui/screen7_screen/Screen7View.hpp>

#include <gui/screen7_screen/Screen7Presenter.hpp>

#include <gui/screen8_screen/Screen8View.hpp>

#include <gui/screen8_screen/Screen8Presenter.hpp>

#include <gui/screen9_screen/Screen9View.hpp>

#include <gui/screen9_screen/Screen9Presenter.hpp>

#include <gui/screen10_screen/Screen10View.hpp>

#include <gui/screen10_screen/Screen10Presenter.hpp>

using namespace touchgfx;

FrontendApplicationBase::FrontendApplicationBase(Model& m, FrontendHeap& heap)

  : touchgfx::MVPApplication(),

   transitionCallback(),

   frontendHeap(heap),

   model(m)

{

  touchgfx::HAL::getInstance()->setDisplayOrientation(touchgfx::ORIENTATION_PORTRAIT);

  reinterpret_cast<touchgfx::LCD16bpp&>(touchgfx::HAL::lcd()).enableTextureMapperAll();

}

/*

 * Screen Transition Declarations

 */

// Screen1

void FrontendApplicationBase::gotoScreen1ScreenNoTransition()

{

  transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoScreen1ScreenNoTransitionImpl);

  pendingScreenTransitionCallback = &transitionCallback;

}

void FrontendApplicationBase::gotoScreen1ScreenNoTransitionImpl()

{

  touchgfx::makeTransition<Screen1View, Screen1Presenter, touchgfx::NoTransition, Model >(&currentScreen, &currentPresenter, frontendHeap, &currentTransition, &model);

}

mchin.1
mchin.1Author
Associate II
November 13, 2021

1st screen is ok but for rest of the screens i did not get so how can i change my application from screen1 to screen 2 with out interaction. i need that give me support & concept.

MM..1
Super User
November 13, 2021

OMG yes without interaction you need add this manualy to GUI files as everythink.

FrontendApplication.cpp

#include <gui/common/FrontendApplication.hpp>
 
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
 : FrontendApplicationBase(m, heap)
{
 
}
 
add here screen 2 3 4 ...
void FrontendApplication::gotoScreen2ScreenNoTransition()
{
 transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoScreen2ScreenNoTransitionImpl);
 pendingScreenTransitionCallback = &transitionCallback;
}
 
void FrontendApplication::gotoScreen2ScreenNoTransitionImpl()
{
 touchgfx::makeTransition<Screen2View, Screen2Presenter, touchgfx::NoTransition, Model >(&currentScreen, &currentPresenter, frontendHeap, &currentTransition, &model);
}

and into hpp ...

mchin.1
mchin.1Author
Associate II
November 14, 2021

Thank you OK Is It works ? I will tell you after try manual addition.

Please tell about this stuff how to use beacause i am very new

Thank you but i have seen below information

switchScreen

virtual void switchScreen(Screen *newScreen)Switch to another Screen.Will call tearDownScreen on current Screen before switching, and subsequently call setupScreen and draw automatically for the new Screen.Parameters:newScreenA pointer to the new screen.

how can i use this to switch from one screen to other

virtual void switchScreen(Screen *newScreen)

MM..1
Super User
November 14, 2021

maybe try

application().switchScreen( &Screen2View );

mchin.1
mchin.1Author
Associate II
November 14, 2021

Hi

screen changing is working fine.

i have a doubt about buttons.

If i add any button with out interaction how can i know is that button pressed or not?

Is button operation work without button interaction?

MM..1
Super User
November 14, 2021

Mark answer , that help you as best and open new thread for this question out of topic