Re: [gtk-list] Main Window References Dialog Window(or vica versa)?

From: George Deprez <>
> Hello All,
> I have a window which creates and pops up a dialog with an entry.
> When the OK button is pressed the callback obtains the entry
> data and MUST update data in the main window.
> What is the best way to exchange information between windows.
> Is there a way to get any top_level window by name?

    By name ? What do you mean here ?

> I  want to minimize the use of globals.
> How about using object_set_data( Window1, "window2", window2);

    That's fine. You should read the related FAQ
    questions for more information on this subject.

> Am I wasting alot of memory doing this?

    Unless you develop some specific application for
    some limited memory machine, I suppose you can
    assume that the users of your program have more
    than 256KB of RAM.
    An BTW, it does not eat too much memory :)
    (roughly : the datalist - the underlying
    structure - will allocated some memory to
    copy the name of your data object and to
    handle the list of all your datas. Not
    a terrible issue). 

    As a side note, you should notice that 
    using a lot of memory is not really a big problem
    on today's machine. I may be wrong, but I think
    that limitating a GUI based software in order
    to have it running on deprecated machine is
    just a waste of energy and time. 

> Will I lose the data when a window is destroyed?

    Er... If you allocated some datas, I do not
    think they will be destroyed (unless you
    use object_set_data_full() to provide the
    correct dtor function.

    But if you do not care, you'll loose the
    pointers and this will probably result in
    some memory leaks.

> Also, a side question -------------------------------
> How can I disable the destroy button on a dialog window?
> I want to force the users to use the OK and CANCEL buttons.
> file://----------------------------------------------

    You should have a look to gtk_window_set_functions()
    - note that this will require a WM which support
    WM hints requests.


> Any help appreciated.
> Thanks,
> George.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]