I have some issues (questions in some cases) with my application:
I managed to remove the title bar and the borders around the main window. Now, I need to move somehow the window. I started by this code on the main component of the window:
void mouseDrag(const MouseEvent& event) override {
int x = event.getScreenPosition().x - event.getPosition().x;
int y = event.getScreenPosition().y - event.getPosition().y;
setBounds(x, y, getWidth(), getHeight());
}
and indeed I can move the window but 1) it works the second time I click and drag and 2) It turns my window grey with no content inside it.
In addition to 1) I need to have 3 buttons minimize, maximize and close but I only know the code for the close button: JUCEApplication::getInstance()->systemRequestedQuit(); or JUCEApplication::getInstance()->quit();. What’s the code for minimize, maximize/restore ?
I have a lot of nested custom components in my application. Is there any way for a child component to access parent component’s function? Notice that by parent component’s function I mean the ones I write when I create the class that inherits from component class and not just the functions from the base Component class. I don’t if that makes sense but it’s hard to move info “around” and I don’t like to use global variables.
if (Component* parent = getParentComponent()) {
// do something
}
If you think your parent is a special thing you can use this together with dynamic_cast, e.g.:
if (GroupComponent* group = dynamic_cast<GroupComponent*> (getParentComponent())) {
group->setText ("New title set from my child");
}
No. 1 I don’t know, but maybe tell what kind of window this is, because there are different subclasses of Component, that can be put on the desktop… That might ring a bell for somebody…