cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Data From Screen1 Container A to Screen2

Priyank
Associate II

https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/mixins

Hi, I used the documentation here and attempted to get the problem from the title working, but the issue seems to be the clickHandler is not registering the click. I think this is because the container on which I set the ClickListener on is comprised of a flex button, which has its own click interaciton. Is there any way to fix this? I set the clickListener from the screen page, not the container page. 

void Formulas1View::formulaClickHandler(const Formula& f, const ClickEvent& evt)
{
if (&f == &formula1)
{
Unicode::UnicodeChar* formulaName = formula1.getFormulaName();
presenter->setEditingFormula(formulaName);
}

}

I ran breakpoints and realized on the button click this was never being hit. 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Priyank ,

 

Can you share your project? I am not sure to fully understand the problem.

 

You have a custom container with a button on it.
You put an instance of that custom container on a screen.
At screen level, you select your custom container instance and add a clickListener mixin.
Now, when you click on the flex button in the custom container, you get the click but the clicklListener mixin is not called?

Is that the issue?

 

If instead you want to send data (an int for instance) from a custom container instance that is in screen1 to screen 2, you can check the tutorial 3 : Tutorial 3: Applications with Multiple Screens  

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

5 REPLIES 5
Priyank
Associate II

@GaetanGodart I selected a best answer for the previous thread, was hoping for assistance on this one. I would appreciate any help.

Hello @Priyank ,

 

Can you share your project? I am not sure to fully understand the problem.

 

You have a custom container with a button on it.
You put an instance of that custom container on a screen.
At screen level, you select your custom container instance and add a clickListener mixin.
Now, when you click on the flex button in the custom container, you get the click but the clicklListener mixin is not called?

Is that the issue?

 

If instead you want to send data (an int for instance) from a custom container instance that is in screen1 to screen 2, you can check the tutorial 3 : Tutorial 3: Applications with Multiple Screens  

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Yes, you have it exactly right, thank you! The problem is since the container is flex button, the application picks up the click in the container, but not the click set up for the container from the screen. I need it to pick up the screen click so the data of the container can be grabbed/sent

Can you just call the handleClickEvent inside the function called by the button's click?
Something like:

void buttonIsClicked(intx, int y)
{
    handleClickEvent(button.getX()+x, button.getY()+y);
    /*
    *Whatever you want to do when the button is clicked
    */
}

(you might have to specify the namesapce in which the handleClickEvent function exist).

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
Priyank
Associate II

this is what I currently have

class Formulas1View : public Formulas1ViewBase
{
  public:
  Formulas1View();
  virtual ~Formulas1View() {}
  virtual void setupScreen();
  virtual void tearDownScreen();
  void formulaClickHandler(const Formula& f, const ClickEvent& e);

  protected:
  Callback<Formulas1View, const Formula&, const ClickEvent&> formulaClickedCallback;

void Formulas1View::formulaClickHandler(const Formula& f, const ClickEvent& evt)
{
  if (&f == &formula1)
  {
    Unicode::UnicodeChar* formulaName = formula1.getFormulaName();
    presenter->setEditingFormula(formulaName);
    application().gotoFormulaStandard1ScreenNoTransition();
  }
}