Feature Request: ResizableWindow

Hello Jules,

About ResizableWindow, something apparently not from my own.

I have many little window in my app, resizable, from left&right (not only bottom-right).

Problem: when my window width become too low, impossible to resize to left or right, only possible to modify height. Id est: only the vertical arrow pointer, not diagonal ones.

Is something Juce can extend ? Is there a callback to use to modify margins ?

Thanks.

How small are the windows?

30 px.
And 1 px only for resizing right/left.

I think left/right diagonla resize should be the priority, since you can too resize height.

That’s much smaller than the component was designed for, and a 1 pixel border would be horrific - I hope I never have to actually use your software!

But it should still work…

Does the cursor change to the correct shape when you move it over the different parts of the border?

:lol:

actually i did not put a 1px border.
I said "When window is too small, it makes border 1 px"
Otherwise i get enough space for resizing diagonally.

1px is not my own.

[quote]
Does the cursor change to the correct shape when you move it over the different parts of the border?[/quote]
Yes, but to become diagonal (left or right) it has only 1 px wide since box is too small.

Why did I that ?
Actually my software is like Max5 or Reaktor. Exactly the same, but objects are bigger, and made in the beginning from juce windows.
To make my own, whatever, I’ll copy paste your code and correct to my wish or delete many parts.

Currently, why couldnt have a lil windows ?

Why dont consider that diagonal cursor is far more important from vertical one ?

Jules, try my horrible software… http://www.plateforme-virage.org/?p=1297

Looks like an ambitious project!

Well, this is how it decides how to resize:

[code]void ResizableBorderComponent::updateMouseZone (const MouseEvent& e) throw()
{
int newZone = 0;

if (ResizableBorderComponent::hitTest (e.x, e.y))
{
    if (e.x < jmax (borderSize.getLeft(), proportionOfWidth (0.1f)))
        newZone |= zoneL;
    else if (e.x >= jmin (getWidth() - borderSize.getRight(), proportionOfWidth (0.9f)))
        newZone |= zoneR;

    if (e.y < jmax (borderSize.getTop(), proportionOfHeight (0.1f)))
        newZone |= zoneT;
    else if (e.y >= jmin (getHeight() - borderSize.getBottom(), proportionOfHeight (0.9f)))
        newZone |= zoneB;
}

[/code]

So in a decent-sized box, the diagonal hit boxes would be 10% of the width or height, which is normally plenty. I guess in very small ones it could be a bit smarter and use a bigger percentage. Something like this:

    if (ResizableBorderComponent::hitTest (e.x, e.y))
    {
        if (e.x < jmax (borderSize.getLeft(), 
                        proportionOfWidth (0.1f), 
                        jmin (10, proportionOfWidth (0.33f))))
            newZone |= zoneL;
        else if (e.x >= jmin (getWidth() - borderSize.getRight(), 
                              proportionOfWidth (0.9f),
                              getWidth() - jmin (10, proportionOfWidth (0.33f))))
            newZone |= zoneR;

        if (e.y < jmax (borderSize.getTop(), 
                        proportionOfHeight (0.1f), 
                        jmin (10, proportionOfHeight (0.33f))))
            newZone |= zoneT;
        else if (e.y >= jmin (getHeight() - borderSize.getBottom(), 
                              proportionOfHeight (0.9f),
                              getHeight() - jmin (10, proportionOfHeight (0.33f))))
            newZone |= zoneB;
    }

(that’s completely untested, BTW)

“Ta” for revision #740. Highly appreciated.
Greetings from Virage platform developers.