Mouse overrides

Hopefully a simple question. I want to increase the font on enter to a label and back to normal on exit.
I am over a label so would expect event.eventComponent to be a label but its a component and has no setFont() method. Do I have to cast it to a Label or am I missing something here? I know its the right label component as the id’s are correct.

void VFODigit::mouseEnter(const MouseEvent& event) {
	event.eventComponent->setFont(Font(MHZ_FONT_OVER, Font::plain));
	String id = event.eventComponent->getComponentID();
	printf("Enter %s\n", id);

Found the right cast (Label*const) which seems to work.

Your VCODigit is the component. so, just call setFont(Font(MHZ_FONT_OVER, Font::plain));

Thanks, that’s a lot simpler.

Also, overriding these two functions expresses the intent better than using the mouse activity. Oh, and it will also do the right thing if they get into the component via a key, instead of the mouse.

virtual void editorShown (TextEditor *)
Called when the text editor has just appeared, due to a user click or other focus change. More…
virtual void editorAboutToBeHidden (TextEditor *)
Called when the text editor is going to be deleted, after editing has finished. More…

oh, I also just remembered there are onEditorShow and onEditorHide members you can use instead of the overrides, if you want.