Login / Register 0 items | $0.00 New @ KVR
timefreezer
KVRist
 
38 posts since 24 Jun, 2005, from Berlin, Germany

Postby timefreezer; Mon Apr 16, 2018 9:59 am How to inherit the CAnimKnob class to catch the right mouse button?

Hi. I just wanted to catch the right mouse button on sliders and buttons. Then I made a derived class MyCAnimKnob and MyCHorizontalSlider.

bool Learning; //flag that I added for the MIDI-Learn mode

MyCAnimKnob(const CRect &size, CControlListener *listener, long tag,
long subPixmaps, // number of subPixmaps
CCoord heightOfOneImage, // pixel
CBitmap *background, CPoint &offset) : CAnimKnob(size, listener, tag,
subPixmaps, // number of subPixmaps
heightOfOneImage, // pixel
background, offset) {
inset = 0;
};

//then I added the mouse information:
CMouseEventResult onMouseDown(CPoint &where, const long &buttons) {

//check if it is a right mouse click
if (buttons > 3) // 4 in Windows and 8 in Mac
Learning = true;

//back to normal mouse routine
CAnimKnob::onMouseDown (where, buttons );
};

everything worked fine with one HUGE exception:
ONLY in Logic Pro X it was from then impossible to turn the knobs any more with the mouse, only with MIDI.

When debugging it also worked, but this is not a state.

What am I missing? Should I copy all the functions of MyCAnimKnob? Other suggestions?
before time there was no time
timefreezer
KVRist
 
38 posts since 24 Jun, 2005, from Berlin, Germany

Postby timefreezer; Tue Apr 17, 2018 6:23 am Re: How to inherit the CAnimKnob class to catch the right mouse button?

Hi all. For those who are interested. I found the solution myself.

In the past onMouseDown was a void. Now it is of the type CMouseEventResult and needs a return value: return kMouseEventHandled;

That's it. Now my right-click is working perfectly.

All the best to all developers.
before time there was no time

Moderator: Moderators (Main)

Return to DSP and Plug-in Development