cancel
Showing results for 
Search instead for 
Did you mean: 

I want to receive the callback function from the button of "Container" by generating an event from "Screens".

mSH.1
Associate III

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.

This discussion is locked. Please start a new topic to ask your question.
6 REPLIES 6
Andrew Neil
Super User

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 that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

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.​

​

Sorry - what was implemented?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
mSH.1
Associate III

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​

​

​

So what's that got to do with callbacks?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
mSH.1
Associate III

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.