PDA

View Full Version : Scope problem inside control


RRokkenAudio
08-17-2010, 12:24 AM
Trying to do this, I get the "undeclared identifier" error:

void TopMultiControl::OnMouseUp(int x, int y, IMouseMod* pMod)
{
m_pPlug->GetGUI()->HideControl(kLFgain,true);

SetDirty();
}



Even though kLFgain, when I hover over, is showing that its an enum..

~Rob.

EDIT:class TopMultiControl : public IKnobControl
{
public:

TopMultiControl(IPlugBase* pPlug, int x, int y, int paramIdx, IBitmap* pBitmap,
EDirection direction = kVertical, double gearing = DEFAULT_GEARING)
: IKnobControl(pPlug, &IRECT(x, y, pBitmap), paramIdx, direction, gearing), mBitmap(*pBitmap) {}
~TopMultiControl() {}

bool Draw(IGraphics* pGraphics);
virtual bool IsHit(int x, int y) { return mTargetRECT.Contains(x, y); }
virtual void OnMouseUp(int x, int y, IMouseMod* pMod);

private:
IBitmap mBitmap;
IPlugBase *m_pPlug;

};

RRokkenAudio
08-17-2010, 05:59 PM
Weird, I thought that because it would recognize the enum(integer) it would recognize kLFgain, but using just the int for the enum worked.. So I just made the enums a separate .h and included.

~RR.

cerberus
08-18-2010, 03:06 PM
i was able to use the index (id) number in my custom control definition without moving the enums section out of my main .cpp

e.g. in my "customControls.h" : void IShuttleControl::OnMouseDown(int x, int y, IMouseMod* pMod)
{
if (pMod->R) {
PromptUserInput();
}
for ( int j = 0; j < 15; j++){
mPlug->GetGUI()->GrayOutControl(j, true);
}

mPlug->GetGUI()->HideControl(26,false);
mPlug->GetGUI()->HideControl(27,false);

} // rr


works great so far; thanks for your help rr!

i wish the methods for mouse handlers/obververs/listeners were more worked out...
eventually i may need cc_'s ISubject.h file? putting the method in the control itself seems
hackish to me, since now i can't simply use that control subclass in another plug-in (as is).

RRokkenAudio
08-18-2010, 04:37 PM
Moving the enums out is a better way than just putting the numbers in.... but being such a small amount of them such as your code I guess it would be fine, if you put in your comments, the actual enum name that is being messed with..

~RR.