Skip to main content
April 4, 2021
Solved

problem with handleDragEvent

  • April 4, 2021
  • 2 replies
  • 1017 views

Hello, when I use handleDragEvent and handleClickEvent, widgets such as buttons and sliders that need to be clicked and dragged no longer work. How can I solve this problem?

This topic has been closed for replies.
Best answer by Alexandre RENOUX

Hello mbagh.1,

I suppose you are not too familiar with object-oriented programming but I'll try to explain simply.

When you implement handleClickEvent() in your ScreenView, you are actually overwriting the one from ScreenViewBase. handleClickEvent() is a virtual function which means that the last implementation will be the one that will prevail over all the others.

So to make sure your widgets receive the event correctly you need to recall the function implemented in the ViewBase.

Here is sample code :

//In ScreenView
void ScreenView::handleClickEvent(const ClickEvent& evt)
{
 // Do your thing
 
 ScreenViewBase::handleClickEvent(evt);
}

When your question is answered, please close this topic by choosing Select as Best.

/Alexandre

2 replies

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
April 5, 2021

Hello mbagh.1,

I suppose you are not too familiar with object-oriented programming but I'll try to explain simply.

When you implement handleClickEvent() in your ScreenView, you are actually overwriting the one from ScreenViewBase. handleClickEvent() is a virtual function which means that the last implementation will be the one that will prevail over all the others.

So to make sure your widgets receive the event correctly you need to recall the function implemented in the ViewBase.

Here is sample code :

//In ScreenView
void ScreenView::handleClickEvent(const ClickEvent& evt)
{
 // Do your thing
 
 ScreenViewBase::handleClickEvent(evt);
}

When your question is answered, please close this topic by choosing Select as Best.

/Alexandre

April 5, 2021

Thank you very much for your excellent guidance