[Glade-users] [Fwd: Re: How to access a new window]



-------- Forwarded Message --------
From: Agam Dua <agamdua at gmail.com>
To: Alexey Kurochkin <alexey.kurochkin at pathfinderlwd.com>
Subject: Re: [Glade-users] How to access a new window
Date: Tue, 6 Jul 2010 19:32:46 +0530

Hi


I understand what you're saying, I'm just not sure:
     1. Which callback function to use if I'm going to use a separate
        glade file
     2. How to generate another window to my requirements from the
        same glade file and again, which callback to use from there

As I understand from what you've said, you already have main window with
some kind of help section which has a button called 'about'. Is that
right? So you define a function of the form

void my_callback (GtkButton *button, gpointer user_data)

and set it as a callback for that button "clicked" signal. Every time
you click that button, the function will be called, and there it's up to
you what that function would be doing. In first scenario, it should open
the glade file in usual manner, run the dialog and destroy it after the
user closes it. In the second scenario, it should just show a dialog
which was created in your main program, without destroying it, so you
can show it when button is clicked again.

You may have as many windows in one glade file as you wish. Every time
you load a file with GtkBuilder it will create brand new instances of
ALL the objects in that file (unless you specify it to create only
particular objects). So if you have both main window, and about dialog
in the same file, it means that everything was already created the first
time you called gtk_builder_add_from_file(). All you need to do is to
keep pointers to all the widgets you have, obtained with
gtk_builder_get_object(), and show/hide them on demand.

Thanks in advance
Regards
Agam

On Tue, Jul 6, 2010 at 7:07 PM, Alexey Kurochkin
<alexey.kurochkin at pathfinderlwd.com> wrote:
        On Sat, 2010-07-03 at 15:02 +0530, Agam Dua wrote:
        > Hi
        >
        > I want to open a new window for the 'about' button in help
        section.
        > Can someone guide me on how i can do this?
        >
        > Should i use a get_object function or something to connect a
        new glade
        > file or should i just make a new window pop out in this file
        itself?
        > Pls advise. Thank you!
        
        
        It can be done either way. In general you just connect a
        callback
        function to that button's "clicked" signal and there you
        present the
        dialog if it's already created from the main glade file, or
        open
        separate glade file if you prefer to keep it modular.
        
        I feel like you probably need to go through some of the
        tutorials from
        http://glade.gnome.org/
        
        
        
        
        _______________________________________________
        Glade-users maillist  -  Glade-users at lists.ximian.com
        http://lists.ximian.com/mailman/listinfo/glade-users







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