Skip to main content
MaChao
Associate II
April 11, 2021
Solved

The custom container cannot respond to ClickEvent and DragEvent

  • April 11, 2021
  • 1 reply
  • 3203 views

Hi

Currently in the project, I am using a custom container and want to implement DragEvent and ClickEvent in the custom container. I follow the instructions to configure my container.hpp and container.cpp, but nothing works.I use the same method in the main interface can be used normally, do I need other configuration?

Thank you in advance for your help.

This topic has been closed for replies.
Best answer by Michael K

Make sure the custom container object in your Screen has the ClickListener mixin enabled in touchgfx designer, or declare it in the ScreenView.cpp file as:

touchgfx::ClickListener< CustomContainerClass > customContainerName;

1 reply

Alexandre RENOUX
Visitor II
April 12, 2021

Hello,

Could you enclose your UI project ?

/Alexandre

MaChao
MaChaoAuthor
Associate II
April 12, 2021

Hi,Alexandre:

Thank you for your reply,I'm sorry that I can't enclose my project, but this situation is easy to repeat. Create a mainscreen of 800*480, and I define the pixel size of my custom container to be 600*400. Add the custom container as a widgets to the mainscreen, and implement the following two functions in the custom container:

virtual void handleClickEvent(const touchgfx::ClickEvent& evt);

virtual void handleDragEvent(const touchgfx::DragEvent& evt);

My clicking and dragging in the widget doesn't go into the handler

Michael K
Michael KBest answer
Senior III
April 16, 2021

Make sure the custom container object in your Screen has the ClickListener mixin enabled in touchgfx designer, or declare it in the ScreenView.cpp file as:

touchgfx::ClickListener< CustomContainerClass > customContainerName;

Embedded UI/UX Consulting: cadenza.design