如何取得widget的指针。
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
如何取得widget的指针。
void on_button1_clicked (GtkButton *button, gpointer user_data)
{
//只有一个*button可以取得。
GtkWidget *w=lookup_widget (GTK_WIDGET(button), "entry2");
//使用包含的h文件中的lookup_widget可以。
GtkEntry *t; // = button->parent->entry2
//能不能这样取?
t=GTK_ENTRY(w);
//强制转换成GtkEntry*。
}
{
//只有一个*button可以取得。
GtkWidget *w=lookup_widget (GTK_WIDGET(button), "entry2");
//使用包含的h文件中的lookup_widget可以。
GtkEntry *t; // = button->parent->entry2
//能不能这样取?
t=GTK_ENTRY(w);
//强制转换成GtkEntry*。
}
● 鸣学
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
-
- 帖子: 29
- 注册时间: 2005-08-20 3:56
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- yonsan
- 帖子: 887
- 注册时间: 2005-07-01 18:56
- 来自: 广州市
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- yonsan
- 帖子: 887
- 注册时间: 2005-07-01 18:56
- 来自: 广州市
g_object_get_data ()
Gets a named field from the objects table of associations (see g_object_set_data()).
object : GObject containing the associations
key : name of the key for that association
Returns : the data if found, or NULL if no such data exists.
是这个吗? 呵呵!
代码: 全选
gpointer g_object_get_data (GObject *object, const gchar *key);
object : GObject containing the associations
key : name of the key for that association
Returns : the data if found, or NULL if no such data exists.
是这个吗? 呵呵!
I will be back!
-
- 帖子: 29
- 注册时间: 2005-08-20 3:56
- yonsan
- 帖子: 887
- 注册时间: 2005-07-01 18:56
- 来自: 广州市