So I need to be able to tell when the mouse gets dragged up and down in my plugin. So I look in The example solution "IPlugMouseTest" and it has nice simple working code that detects when the mouse gets dragged in different directions, great! but when I implement almost identical code in my plugin the OnMouseDrag function never gets called! wtf? Here is my code
Code:
class DragIncrementer : public IControl
{
public:
DragIncrementer(IPlugBase *pPlug, IRECT pR, int paramA, int paramB,float bpmChange)
: IControl(pPlug, pR)
{
AddAuxParam(paramA);
AddAuxParam(paramB);
AddAuxParam(bpmChange);
}
int lastY;
bool Draw(IGraphics* pGraphics)
{
return true;
}
void OnMouseDown(int x, int y, IMouseMod* pMod)
{
lastY = y;
}
void OnMouseUp(int x, int y, IMouseMod* pMod)
{
lastY = 0;
}
void OnMouseDrag(int x, int y, IMouseMod* pMod)
{
int bpmChange = y - lastY;
lastY = y;
GetAuxParam(2)->mValue = bpmChange;
SetDirty();
}
void SetDirty(bool pushParamToPlug = true)
{
mDirty = true;
if (pushParamToPlug && mPlug)
{
SetAllAuxParamsFromGUI();
}
}
private:
};
Then I create this control just like in the example
Code:
pGraphics->AttachControl(new DragIncrementer(this, IRECT(0, 0, kWidth, kHeight), kPitchA, kPitchB, bpmInc));
where pGraphics is my IGraphics pointer
The OnMouseDown and OnMouseUp functions get called no problem. When I set breakpoints inside OnMouseDrag() the debugger tells me "The breakpoint will not currently be hit. No executable code of the debugger's target type is associated with this line. Possible causes include: conditional compilation, compiler optimizations, or the target architecture of this line is not supported by the current debugger code type"
Really baffled by this one, hope someone has an idea of what it could be. I really like the way IPlug allows for a lot of customizing your own controls, however I seem to have nothing but problems with trying to get it to work properly.