Hi There,
No doubt the problem I am having is due to my lack of experience with JUCE framework but here goes:
I am trying create a custom MouseListener for the PluginEditor, so that when a mouse event is detected within the editor window the "hello world" string is changed to "hello mouse" to test that it works.
The ProjectJuceAudioProcessorEditor constructor is as follows:
ProjectJuceAudioProcessorEditor::ProjectJuceAudioProcessorEditor(ProjectJuceAudioProcessorEditor *ownerFilter) : AudioProcessorEditor(ownerFilter){
setSize(400,300); // Set window size
str = "hello world"; // String to be drawn by g.drawFittedText(str, ...,) in paint()
this->addMouseListener(new PluginEditorMouseListener(&str), true); // Adding Custom Event Listener to the PluginEditor
}
The PluginEditorMouseListener nested class is defined within ProjectJuceAudioProcessorEditor definition as follows:
class PluginEditorMouseListener : public MouseListener {
private:
// Pointer to str object above so that its value can be changed in the listener
std::string *strPtr;
public:
// Constructor to point the string pointer at the external string object
PluginEditorMouseListener (std::string *sp) : MouseListener() {
strPtr = sp;
}
// Overriden version of mouseMoved (when mouseMoved within editor str
// should change from "hello world" to "hello mouse"
virtual void mouseMoved(const MouseEvent &event){
*strPtr = "hello mouse";
}
}
It compiles fine but I don't see any change in the "hello world" string when the mouse is moved within the editor.
Is this the advised method of doing this or am I going about it incorrectly?
Best,
P
Edit: Apologies "mouseMouse" was meant to be "mouseMoved"
