[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Re: How to communicate between two GtkWindow widgets?
- From: "Jim George" <jimgeorge gmail com>
- To: "张散集" <zhangsanji 126 com>
- Cc: gtk-app-devel-list gnome org, zhang_sanji_1981 <zhang_sanji_1981 yahoo com cn>
- Subject: Re: Re: How to communicate between two GtkWindow widgets?
- Date: Thu, 23 Aug 2007 11:29:54 -0600
On 8/23/07, 张散集 <zhangsanji 126 com> wrote:
>
>
> Hi Jim,
>
> Thanks for your reply. There is a figure.
>
> Well, on the picture above, win_A is the main GtkWindow, win_B is a child GtkWindow.
> When I click the button on win_B I want to change the label_A's text.
> That's it. If know how to do this, I will do other things to accomplish my task.
>
> Thanks
>
Please send your replies to the list as well (use reply-all).
You need to pass a pointer to the second widget in the user parameters
when connecting to the first widget. A simple example would be:
g_signal_connect(win_b_button, "clicked", win_b_clicked_cb, win_a_label);
void win_b_clicked_cb(GtkButton *b, gpointer *user_data)
{
gtk_label_set_label(GTK_LABEL(user_data), "Button was clicked");
}
Typically, programs will create a structure containing pointers for
all widgets they use, then pass a pointer to this structure to all the
signal handlers.
-Jim
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]