我在主窗口中有一个滚动窗口。我想当我单击按钮刷新时,滚动窗口的内容将自动刷新。这是对按钮的回调
vbox = gtk_vbox_new(TRUE, 5);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), vbox);
gtk_signal_connect(GTK_OBJECT(button_refresh), "clicked", GTK_SIGNAL_FUNC(button_re), NULL);
有回调函数:
void button_re(GtkWidget *window, gpointer data){
connectserver(myFile, numof);//connect to server and get information
if(numof > 0){
for(int i = 0; i< numof; i++){
hbox = gtk_hbox_new(TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
sprintf(buffer, "%s", myFile[i].name);
label = gtk_label_new(buffer);
button_down = gtk_button_new_with_label("Download");
gtk_signal_connect(GTK_OBJECT(button_down), "clicked", GTK_SIGNAL_FUNC(button_download), (gpointer ) i);
gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), button_down, TRUE, FALSE, 0);
}
}else if(numof == 0){
label = gtk_label_new("Have nothing on server");
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, FALSE, 2);
}
但是当我点击按钮时,没有任何事情发生。我该怎么办?我很抱歉,因为我的英语不好。谢谢 !