Re: question about design
- From: faboo <faboo ellf net>
- To: gtk_list <gtk-app-devel-list gnome org>
- Subject: Re: question about design
- Date: Thu, 06 Sep 2001 23:20:31 -0400
apatruduque wrote:
I have 2 questions:
1- I don't know what is the best thing to do when I
want to close the second window: hide it with
gtk_widget_hide or destroy it with gtk_widget_destroy.
May be in this example is not very important but what
would it happen in a program like gimp? There, you can
finish with a lot of windows in your screen and if
every time you close and open a window you have to
create from scratch, it takes some time. On the other
hand, if you keep all the windows hide, you might be
wasting resources...I guess the answer is "It depends
on your application."
What I'd do in this case, instead of creating a whole new window for
your second type of view, put all of your "extra" buttons in their own
container (a GtkBox or what have you), whether created on the fly as
Havoc suggests or kept around for the duration of the program (the less
efficient, but quicker solution). Then when you need it, add it in along
side your normals, which also have their own container, like this:
(cheesy ascii art ahead)
/--------------------------------\
| Main Calc Window |
|/------------------------------\|
|| GtkHBox for button containers||
||/-------------\/-------------\||
||| Normal || Extra |||
||| Button Bin || Button Bin |||
||\-------------/\-------------/||
|\------------------------------/|
\--------------------------------/
2- What to do when it is not only a label but some
more complicated data structure what two windows or
widgets share? Is using global variables and data
structures a solution?
It depends. In a case like this (or even more compicated ones) you can
just go ahead and plop in a new window and gtk+ takes care of the rest.
You could also call gtk_widget_set_parent() to change the parent of the
offending widgets. If you keep all of the widgets you plan on reusing in
one big outer container this isn't all the combersome. Just don't keep
around a bunch of widgets just chillin' doing nothing - it takes up too
much memory.
Thanks again,
Alfonso Alba García
faboo
--
"No hidden catch, "There was nothing to fear
No strings attached - And nothing to doubt"
Just free love." -Pyramid Song,
-Free Love, Radiohead
Depeche Mode
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]