Skip to main content
MaChao
Associate II
Solved

The custom container cannot respond to ClickEvent and DragEvent

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.
Michael K
Michael KBest answer
Senior III

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

7 replies

Alexandre RENOUX
Visitor II

Hello,

Could you enclose your UI project ?

/Alexandre

MaChao
MaChaoAuthor
Associate II

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

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