I want to receive the callback function from the button of "Container" by generating an event from "Screens".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 2:36 AM
hello​
​
I want to receive the callback function from the button of "Container" by generating an event from "Screens".
​
​
The following is the definition of Callback Function for Button in Container.
// @ Container
void CC_Pop_Cancel_Check::flexButton_confirm_event()
{
// Override and implement this function in CC_Pop_Cancel_Check
}
void CC_Pop_Cancel_Check::flexButton_cancel_event()
{
// Override and implement this function in CC_Pop_Cancel_Check
}
​
​
Below are Screens inserted into Container.
#include <gui/scrautoremain_i1_screen/ScrAutoReMain_i1View.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include "BitmapDatabase.hpp"
ScrAutoReMain_i1View::ScrAutoReMain_i1View()
{
}
void ScrAutoReMain_i1View::setupScreen()
{
ScrAutoReMain_i1ViewBase::setupScreen();
}
void ScrAutoReMain_i1View::tearDownScreen()
{
ScrAutoReMain_i1ViewBase::tearDownScreen();
}
​
I want to receive the callback function generated from the button of the container from the scene in the event method.
​
​thank.
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 2:52 AM
Maybe just lost in translation, but you don't "receive" a callback function: you provide the function, and it gets called by the system on the specified event.
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 3:49 AM
hello, Andrew Neil (Community Member)
​
It was implemented by reading the button state of the container periodically with handleTickEvent() of screens.
​
Is this best?
​
tank.​
​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 4:30 AM
Sorry - what was implemented?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 4:10 PM
hello Andrew Neil
​
​
By adding get and set functions to the container, a function that can get the button state from screens was added.
​
// @ Container
void CC_Pop_Cancel_Check::flexButton_confirm_event()
{
button = 1;
}
void CC_Pop_Cancel_Check::flexButton_cancel_event()
{
button = 2;
}
int CC_Pop_Cancel_Check::getPop_button()
{
return button_start_check;
}
void CC_Pop_Cancel_Check::setPop_button( int data_s )
{
button_start_check = data_s;
}
​
​
In screens, the get function of the container is read periodically through handleTickEvent() and the state of the button is checked.
​
#include <gui/scrautoremain_i1_screen/ScrAutoReMain_i1View.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include "BitmapDatabase.hpp"
ScrAutoReMain_i1View::ScrAutoReMain_i1View()
{
}
void ScrAutoReMain_i1View::setupScreen()
{
ScrAutoReMain_i1ViewBase::setupScreen();
}
void ScrAutoReMain_i1View::tearDownScreen()
{
ScrAutoReMain_i1ViewBase::tearDownScreen();
}
void ScrAutoReMain_i1View::handleTickEvent()
{
container.getPop_button(); <- Periodically check the button state
}
​
​
First of all, I checked that the above configuration works well, but I have a question about whether this method is effective.
​
thank​
​
​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 4:46 PM
So what's that got to do with callbacks?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-20 4:50 PM
hello Andrew Neil
I couldn't find a way to pass the container callback function to the screen as an event, so I implemented it by polling as follows.
So what I want to know is if callback is possible.. And the method I made is efficient.
