draw a circle during 100ms on each touch screen press with touchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-05 2:10 AM
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
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 12:08 AM
Hi,
You need to add() the circle to the root container. Did you remember to do that? Just add all your circles in setupScreen() (even if they are invisible).
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 12:42 AM
Hi
thank you for the help;
Yes it works better with add function ! but now i am facing a new problem : my boxClickHandler is no more called
Now that the virtual handleClickEvent function is coded, how can we still receive event in all the callback of our widgets (box, images...) ?
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 1:29 AM
Simply forward the event to your widgets if you want only specific widgets to receive the event:
myWidget.handleClickEvent(evt);
And forward it locally to your entire view if you want every widget to receive it:
View::handleClickEvent(evt);
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 1:36 AM
The more correct way to do this is to create a custom widget that registers for ticks. You can find many examples of this in the framework- Check the containers/SlideMenu.cpp or containers/SwipeContainer.cpp, for instance.
Application::getInstance()->registerTimerWidget(this);
In this way your widgets would be self aware of when to hide themselves, and you would not have to override the handleTickEvent() method to keep track of when to hide which circle. e.g. if the user touches two spots on the display in quick succession, you would have to manage ticks for each of those manually.
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 1:37 AM
All my screens code is structured by using the setClickAction() function in the constructor of the screen :
digicode_box_click0.setClickAction(BoxClickedCallback);
and in the callback i test each widget
void DigicodeView::digicode_boxClickHandler(const Box& b, const ClickEvent& evt)
{
//Checking code
//treat only pressed event
if (evt.getType() != ClickEvent::PRESSED) return;
if (&b == &digicode_box_click0)
{
updateEnteredCode(0);
}
.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 1:37 AM
So i don't know how to call each widget with myWidget.handleClickEvent(evt);......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 1:42 AM
Hello
thank you for your reply
i don't want the widget that are on the screen to be modify by the click event, i just want to know when a click is for them...
On the click event it is OK i can draw a circle, and on the tick event i can clear it, but i also want the callback of the widget to be called...
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 1:44 AM
I updated the post above related to forwarding:
If you want to forward locally to the entire view, call the following. This way you won't have to forward to each widget.
View::handleClickEvent(evt);
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 1:50 AM
Okay, then you do not need to implement the handleClickEvent() method in your view. You could even have the circle be a part of your widget and have the widget display it depending on the coordinates pressed (your widget also implements handleClickEvent() )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-06 2:12 AM
Thanks for the reply...
I don't understand you reply... but your code View::handleClickEvent(evt); seems to work fine : the event is well propagated for the boxes once treated byhandleClickEvent function (that draw the circle).
So i have to add the handleClickEvent function in all the screen view code ?
Best regards
