How can I get trigers button click and button unclick?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-10 06:44 AM
I want to use a button, than I need button click and unclick time execute virtual function. How can it?
Thanks.
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-11 02:40 AM
I'm not really understand what's you want, but as my guest, I think you need to call function when the button Pressed and one again when Released.
You can refer this function, add to ScreenView.cpp. and dont forget to define it at header file.
Best Regard,
Hieu
void Screen1View::handleClickEvent(const ClickEvent& evt)
{
if (your_object.getRect().intersect(Rect(evt.getX(), evt.getY(), 1, 1)))
{
if (evt.getType() == ClickEvent::PRESSED)
{
// Your code when Pressed
}
if (evt.getType() == ClickEvent::RELEASED)
{
// Your code when Released
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-11 01:45 AM
Hello,
Can you reformulate your question and maybe elaborate ? I unfortunately don't understand your issue.
/Alexandre
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-11 02:40 AM
I'm not really understand what's you want, but as my guest, I think you need to call function when the button Pressed and one again when Released.
You can refer this function, add to ScreenView.cpp. and dont forget to define it at header file.
Best Regard,
Hieu
void Screen1View::handleClickEvent(const ClickEvent& evt)
{
if (your_object.getRect().intersect(Rect(evt.getX(), evt.getY(), 1, 1)))
{
if (evt.getType() == ClickEvent::PRESSED)
{
// Your code when Pressed
}
if (evt.getType() == ClickEvent::RELEASED)
{
// Your code when Released
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-11 11:42 PM
Thank you, HPham and Alexandre,
My question: I need to get signal when pressed a button and released button. This answer is ok for me.....
B.Regards.
Ahmet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-12 03:42 AM
Thank you…. Code Worked fine….
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-12 04:12 AM
you should set this question is answered, it'll help others person
Hieu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-13 02:45 AM
You can check here, this another method.
It worked for me.
Pierre
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-14 12:09 AM
Thank you Pierre,
I will try it.
Ahmet.