cancel
Showing results for 
Search instead for 
Did you mean: 

problem with handleDragEvent

mbagh.1
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

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

View solution in original post

2 REPLIES 2
Alexandre RENOUX
Principal

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

Thank you very much for your excellent guidance