Ask Your Question

how to remove trackbar from opencv image window?

asked 2013-05-24 05:42:44 -0500

Paramesh Reddy gravatar image

I am working with TrackBar in opencv.I need to display trackbar if i click left mouse button and need to remove trackbar after clicking mouse middle button.

after clicking left mouse button its displaying trackbar but how to remove from the same window on clicking middle mouse button? can any one give me a suggestion about how to do this one.


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-05-24 07:45:21 -0500

Heshan Sandeepa gravatar image

i think track bar supports only for the "Click" event in windows forms. There are nothing as "MiddlemousebuttonClick" or "Rightmousebuttonclick" events in windows forms. So that you can try to develop some code to make the trackbar visible or not. I mean something like a flag with a IF condition. At the very first click on track bar , set the flag as "1" and set the track bar visible property is true . then when you click again on the track bar, the same "Click" event get fired and then using current flag value , you can set the visible property false.

edit flag offensive delete link more


Thanks .............i got it

Paramesh Reddy gravatar imageParamesh Reddy ( 2013-05-30 04:32:36 -0500 )edit

Cool! Maybe you want to accept/mark the answer as solved if this helped you.

Heshan Sandeepa gravatar imageHeshan Sandeepa ( 2013-05-30 07:17:42 -0500 )edit

@David Jhones, what do you mean by "visible" property? I've looked in the HighGUI reference and the only things that are associated with a trackbar are cv::createTrackbar, cv::getTrackbarPos and cv::setTrackbarPos. As far as I know you cannot change anything but the state (as in slider-value, button-value) of a GUI element in HighGUI. Please explain. Creating a named windows inside the infinite loop and each time adding a new trackbar to it is a possible solution but it's quite ugly.

rbaleksandar gravatar imagerbaleksandar ( 2014-06-13 10:32:26 -0500 )edit

@paramesh i know this is too late. But i was meant about the Visual C++ button events in forms. Not related to OpenCV codes.

Heshan Sandeepa gravatar imageHeshan Sandeepa ( 2015-03-14 09:17:25 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-05-24 05:42:44 -0500

Seen: 1,323 times

Last updated: May 24 '13