cancel
Showing results for 
Search instead for 
Did you mean: 

The custom container cannot respond to ClickEvent and DragEvent

MaChao
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

7 REPLIES 7
Alexandre RENOUX
Principal

Hello,

Could you enclose your UI project ?

/Alexandre

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

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

Thank you for your reply. I tried to open the ClickListener mixin of the custom container, and the click was effective. However, when I opened the drag and drop event, I was not quite sure how to operate it.Also hope to get your help, thank you!

Sorry, I don't understand your question. Are you saying your drag event isn't being called?

When writing my previous answer I created a test project to ensure what I wrote worked, and both handleClickEvent and handleDragEvent functions were being called properly.

Make sure that your clicklistener mixin is selected in your screen, not in an element within the custom container.

Embedded UI/UX Consulting: cadenza.design

Sorry, I'm thinking of wrapping click-and-drag events in a custom container so that each container can be handled separately for code decoupling..Now it seems that this can not be realized. I can only deal with it in my screen as you said.Thank you for your patience!

You're welcome, glad it helped. Please click "Select as Best" on my first comment, which will make it easier for folks to find the solution to this problem in the future.

Embedded UI/UX Consulting: cadenza.design