Skip to main content
V.H
Senior
August 24, 2022
Question

How to add click/drag/gesture event in custom container?

  • August 24, 2022
  • 2 replies
  • 2367 views

Hello all,

I create a custom container and need to used click/drag/gesture event,

but the handleClickEvent/handleDragEvent/handleGestureEvent cannot trigger in it.

How can get these event in custom container?

This topic has been closed for replies.

2 replies

ktrofimo
Senior III
August 24, 2022

I tried to drag custom widget just by adding ​<Draggable> to it. And it works. I feel it should work for containers too. See https://support.touchgfx.com/4.20/docs/development/ui-development/touchgfx-engine-features/mixins#draggable

V.H
V.HAuthor
Senior
August 24, 2022

I want to used gesture to control a value, and your share is to drag the specified object.

Osman SOYKURT
Technical Moderator
August 25, 2022

Hi V.H,

Do you mean you want to handle click/drags with your entire container (and not just elements inside it ?)

If yes, you just need to click on your container inside your screen and check the boxes "Draggable", "ClickListener", and "Move Animator" under Mixins in the right panel (Properties).

0693W00000StjcMQAR.png 

Then you implements the functions you need when triggered. You can be helped by our article here.

/Osman

Osman SOYKURTST Software Developer | TouchGFX
ktrofimo
Senior III
August 25, 2022

I was thinking the same and even sent a link to the same article, but this is not what author wants. Our idea is to drag the whole object on the screen while he needs gestures to change value inside control, but not the position of this control. Like a spin buttons besides numeric field in MFC. When you click this button and move mouse up or down this changes value in a numeric field.