2024-10-03 12:32 PM
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.
Solved! Go to Solution.
2024-10-08 01:02 AM
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,
2024-10-04 09:11 AM
@GaetanGodart I selected a best answer for the previous thread, was hoping for assistance on this one. I would appreciate any help.
2024-10-08 01:02 AM
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,
2024-10-08 08:13 AM
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
2024-10-08 08:24 AM
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,
2024-10-08 08:52 AM - last edited on 2024-10-10 12:48 AM by GaetanGodart
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();
}
}