[Gtk-sharp-list] Interface concept

Leo Spalteholz leo@thewoodpecker.ca
Tue, 21 Oct 2003 22:29:06 -0700


On October 21, 2003 04:35 pm, Joe Scaduto wrote:
> Hey,
>
> I am designing an application and I would like to have a interface where
> the main window is split into 2 separate parts.  I would have the left
> most part be a column of buttons and the right most part be a scrollable
> window.  Where each button represents a service of the application.  The
> problem I am seeing is once a button is pressed the scrollable window is
> "populated" with the correct data.
> i.e) (web log) "Post" button is pressed and the scrollable window
> "populates" with an interface for adding a title and a body with a save
> and cancel button
>
> I only wish to have one "service" available at a time.  But if the user
> wishes to use another "service" the scrollable window updates itself
> with the proper data.
>
> Essentially I want the main area of my application to change dynamically
> based on what service the user wants.  (If you have Evolution....exactly
> how the Shortcut Bar works with the main window)
> I am sorry if I did not explain this very well....if any knows of a
> common way to do this I would appreciate any help.

Well I'm certainly not an expert but I would do it like this:
Put an HBox in the main window.
Pack a VBox into the Hbox
Put all your buttons into this vbox..
Pack another vbox into your Hbox.  This vbox will be where you put your 
scrolledwindow and such.
In your Clicked eventhandler for a button on the left, remove the right 
vbox from your hbox, (hbox.Remove(widgetToRemove)) and populate a new vbox 
with the widgets you want on the new screen.  Then add this new vbox back 
to the hbox.
So when you click the button it will change the contents on the right side.

Which brings me to a minor point.  If you remove a container like a vbox 
from another one, does the vbox and all child widgets get destroyed?
My application switches between screens with many buttons quite often in 
this manner and I've noticed that memory usage of mono increases every 
time...

Thanks,
Leo