cancel
Showing results for 
Search instead for 
Did you mean: 

draw a circle during 100ms on each touch screen press with touchGFX

Professional
Senior

Hello,

Do you know if there is a simple way to make touchGFX draw a circle during a few ms on each touch screen press ?

best regards

25 REPLIES 25
Martin KJELDSEN
Chief III

My reply was on how to avoid having circles in the view itself, but inside a custom widget (since you're showing the circle at the exact spot you're clicking which is the widget that is already handling click events. But if you want to do the view approach - You do not need handleClickEvent() at all actually - You just need the callback handler to show one of the circles at the coordinates that were clicked - you can send these back in your callback.

/Martin

Professional
Senior

Thank for your reply

what do you meen by "You just need the callback handler to show one of the circles at the coordinates that were clicked - you can send these back in your callback"

I want to show a circle where there is a press (it can be on a clickable box or image or on nothing...) I have only one circle that set invisible in tick handler after having been seted in click handler.

So i think i need the handleClickEvent() function ?

Professional
Senior

Hello

can you confirm that the add function for the circle must be done only once in the base class and not in the setupView function (otherwise if the view is called several time the circle doesn't appear any more)

Best regards

Martin KJELDSEN
Chief III

Hi,

If you want to handle showing your circles from your view, and not from the widets, yes you need to define a handleClickEvent() method in your view. If you're displaying a circle and someone requests for that view to be displayed again (you can always guard this - dont switch to a view that's already active) yes, the circle may go a way prematurely - But this is an extreme edge case. If you want this functionality on several views you have to define it in a base class.

/Martin

Professional
Senior

Hello

thank you for your support

It seems to work now, with declaration of circle in the base View class, and handle click callback in the view call that then dispatches the event to all widgets by View::handleClickEvent(evt)

And i will do so for all the view...

Best regards

Martin KJELDSEN
Chief III

That's great! 🙂

/Martin