2022-07-20 02: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.
2022-07-20 02: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.
2022-07-20 03: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.
2022-07-20 04:30 AM
Sorry - what was implemented?
2022-07-20 04: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
2022-07-20 04:46 PM
So what's that got to do with callbacks?
2022-07-20 04: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.