2021-04-04 03:45 AM
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?
Solved! Go to Solution.
2021-04-04 07:06 PM
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
2021-04-04 07:06 PM
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
2021-04-05 03:54 AM
Thank you very much for your excellent guidance