ResizableEdgeComponent for 2 Components


#1

Does anyone know how I can use a ResizableEdgeComponent to resize 2 components? I'm trying to make a simple painting app and I have a side bar that contains controls for changing the way you can paint. Anyways, I want to be able to resize this side bar and I want that to resize the canvas accordingly. Any ideas?

Also, I'm having a problem with components going back to it's initial size from the main component's (which holds the sidebar and canvas) resize funciton. I can't think of a way to make them resizable from both the ResizableEdgeComponent and from the window resize (main component). Any ideas on this too? 

This is my first time trying to make an app like this so I'm figuring a lot out. I'm using a lot of JUCE classes I've never even touched before. It's just an exercise, so it's not of great importance, but I'm trying to learn from it. 


#2

Well, I figured out something that seems to work for the first question. It's a bit weird, but I think it'll do for now. Basically, I'm using a reference to the Canvas and calling this in the SideBar's resize():

drawingCanvas.setBounds(getWidth(), 0, getParentWidth() - getWidth(), getParentHeight());

I'm still having trouble figuring out how I can keep it from going to its old size when I resize the window.


#3

There is a nice tutorial about a (win32) splitter window component here:

http://relisoft.com/win32/splitter.html

This is exactly designed to solve your problem.  Although it uses the pure win32 api, it is helpful to get the idea.