Hello,
Sorry, but again in my life I have problems with understanding documentation. I am trying for 2 days set method mouseDown() and mouseUp() for my resizableCornerComponent.
I have plugin, and in constructor of AudioProcessorEditor I call setResizable(true, true).
Then how to add special behaviour when mouse is down on resizableCorner. I have impression like I’ve already tried everything. But it just doesn’t work for me. I tried to create new ResizableCornerComponent, but have no idea what next. I tried resizableCorner->juce::Component::mouseDown(const MouseEvent &event);
But have no idea what is MouseEvent. I read about that, but I don’t understand. Do I need create MouseEvent variable? For what? What event? Clicking and hold mouse isn’t already event by itself?
I overide mouseDown method. But when I click anywhere, nothing happens. Please help
Why do you need "special behavior " for the ResizableCornerComponent?
Anyway if you really need it, you need to subclass it, override the needed methods and create an instance of the subclass and set that on your parent component. You will likely also need to call the base class methods in your overriden methods to keep the original behavior of ResizableCornerComponent.
class MyCornerComponent : public ResizableCornerComponent
{
public:
MyCornerComponent(Component *componentToResize, ComponentBoundsConstrainer *constrainer)
: ResizableCornerComponent(componentToResize,constrainer)
{}
void mouseDown(const MouseEvent& ev) override
{
ResizableCornerComponent::mouseDown(ev);
// your custom behavior here
}
void mouseUp(const MouseEvent& ev) override
{
ResizableCornerComponent::mouseUp(ev);
// your custom behavior here
}
};
But really, do you actually need that? (You obviously also need to add into the class anything needed to get access your bool parameter or anything else you might need.)
I am not sure if I really need it. I know that at the moment I want it.
I have plugin that draws graph from FFT for impulse response. And when I have really big buffer size, and I am resizing window with my graph, it’s not smooth. So I wanted to set it like that when I am resizing, it would stop drawing in realtime fft output,and start drawing from static data which is remembered. Then resizing works smoothly. And even finally it works now, but I set drawing static data in resized() method, but then it draws both fft output, and static data one by one (or something like that) because resized() doesn’t work continously. That’s why I want to just set bool dontDrawFFT when mouse is down. Is it reasonable?
Hey, great thanks, but I am not sure if I understand it. But I think your code creates new component which is of course ResizableCornerComponent. But I have already resizable corner when I called setResizable(true, true /*that true makes corner visible*/)
And I just want to set mouseDown for that already existed corner.