resizable Panel
resizable Panel
In my program I have a feature where it is possible to investigate your Erlang code. This needs a tree structure drawn on the screen the nodes of which are boxes with styled text controls showing code for the user. I made a custom control for this with wxPanel, there are some buttons on it, etc, it works the way I want, but I dont know if it is possible to make this box (panel) resizable for the user. How could I manage to do this?
Re: resizable Panel
The OS allows a window to be resizable using its border.
A control can't be resizable by the user, just using the mouse.
But if you put your control inside a window so it fulfill the whole window (using a wxsizer), you can achieve it.
Another hard approach is to follow mouse coordinates and resizing the control on your own when mouse is on a border...
A control can't be resizable by the user, just using the mouse.
But if you put your control inside a window so it fulfill the whole window (using a wxsizer), you can achieve it.
Another hard approach is to follow mouse coordinates and resizing the control on your own when mouse is on a border...
Re: resizable Panel
Thank you for your reply!Manolo wrote:The OS allows a window to be resizable using its border.
A control can't be resizable by the user, just using the mouse.
But if you put your control inside a window so it fulfill the whole window (using a wxsizer), you can achieve it.
Another hard approach is to follow mouse coordinates and resizing the control on your own when mouse is on a border...
As you said, if I put my control into a window... but I guess (or I am sure), in that case the user will be able to move (the window and) the control inside of it out of the bigger window and the area (workspace) where these box-like controls are kept. And this would be very bad.
The another approach, following mouse coordinates and calculating borders etc would need too much calculations, am I right? What if I placed some kind of "small hook" (wxButton or something) to the bottom right corner of my box? How could I detect when the user is dragging that "hook" and how could I resize the panel to the proper size?
Re: resizable Panel
If you want that some or all of the controls belonging to a window to change their size when the window changes its size, use [several] wxSizer. I think this is your case. You can call Layout() in response to some user action, and the sizers will do the job.
If you want a window (with controls) to be resizable and movable without going out of its parent window, use MDI (just for MSW) or wxAUI.
If you want a control to be resizable by mouse, but you don't want it to have a border, nor move it, you must handle mouse on your own. What if the user resizes it out of its parent window limits?
If you want a window (with controls) to be resizable and movable without going out of its parent window, use MDI (just for MSW) or wxAUI.
If you want a control to be resizable by mouse, but you don't want it to have a border, nor move it, you must handle mouse on your own. What if the user resizes it out of its parent window limits?