void paint(Graphics& g) override
{
// Paint something here
}
function. I want is every time the size of the screen is changed, the screen will be pain a gain. So, I called repaint(); in the function resized() like this:
void resized() override
{
// Do something
repaint();
}
But the paint(Graphics& g) wasn’t called after the resized() has been called? Can you help me solve this problem?
Thank you @Xenakios
I want to draw some text like this “This is the link to th…” but when I zoom in my screen, the text isn’t changed. My expected result is the text should be “This is the link to the audio website” but it’s not.
My code in paint() here:
Have you ensured resized() itself is even called when zooming in the screen? Maybe there’s some other Component callback for that? Is this about a touchscreen device?
virtual void Component::mouseMagnify
Seems like a candidate…“Called when a pinch-to-zoom mouse-gesture is used”
The poster’s problem appears to be that even if repaint() is called in his overridden resized() method, the repaint is apparently not being done. IMHO the repaint() call is not even necessary though, when the component has been resized, repaint() likely has been called by JUCE already. I wonder if the poster’s resized() implementation’s “do something” part is doing something relevant to the problem?
Like others pointed out: don’t put a repaint() in resized(). It will happen automatically, when the bounds are changed.
If you call repaint() on your Component, but no paint() is happening, there could be one of these situations:
the component is not visible at all (size > 0 and setVisible (true) or addAndMakeVisible not called)
the Component is hidden behind another Component, that is marked opaque but is not painting itself
what Jules just mentioned: confusion with the instances