gtk 两个绘图区互相切换的问题

开发基于GTK+或QT的应用程序
回复
lvwengui2010
帖子: 2
注册时间: 2010-03-30 16:16
送出感谢: 0
接收感谢: 0

gtk 两个绘图区互相切换的问题

#1

帖子 lvwengui2010 » 2010-04-04 15:39

有两个按钮“ana","noise"设置回调函数为给各自的数据画图
在"noise"的回调函数中隐藏"ana"并显示"noise"相应构件,运行后从"ana"切换到"noise"绘图时,第一次点击"noise"按钮时有1s的显示"noise"对应绘图,然后就消失了,第二次点击后才能正常显示"noise"的绘图,不知怎么回事,请高手指点,谢谢。
"noise"回调函数如下:
void noise_canvas_show(gpointer user_data)
{
printf("noise show !\n");
GtkWidget *noise_canvas=lookup_widget(topgui_gnome, "topgui_noise_canvas");
gtk_widget_hide (prof_left_canvas);
gtk_widget_hide (prof_top_canvas);
gtk_widget_hide (prof_color_canvas);
gtk_widget_hide (lookup_widget(topgui_gnome, "topgui_prof_canvas"));
gtk_widget_hide (lookup_widget(topgui_gnome, "topgui_ana_canvas"));
gtk_widget_hide (lookup_widget(topgui_gnome, "topgui_rpt_canvas"));
gtk_widget_show(noise_canvas);

gtk_widget_set_sensitive (lookup_widget(topgui_gnome, "topgui_frame_opt_ana_optbtn"), FALSE);
if(noise_pixmap==NULL)
noise_pixmap=gdk_pixmap_new(noise_canvas->window, NOISE_CANVAS_WIDTH, NOISE_CANVAS_HEIGHT, -1);
creatnoiseviewItem(noise_pixmap, noise_canvas);
}
void
on_topgui_toolbar_noise_clicked (GtkToolButton *toolbutton,
gpointer user_data)
{
//
noise_canvas_show(user_data);
gtk_widget_set_sensitive (lookup_widget(topgui_gnome, "topgui_toolbar_prevch"), FALSE);
gtk_widget_set_sensitive (lookup_widget(topgui_gnome, "topgui_toolbar_nextch"), FALSE);
gtk_widget_set_sensitive (lookup_widget(topgui_gnome, "topgui_frame_opt_rpt_anareslt"), FALSE);
printf("noise have been drown !!\n");
}
lvwengui2010
帖子: 2
注册时间: 2010-03-30 16:16
送出感谢: 0
接收感谢: 0

Re: gtk 两个绘图区互相切换的问题

#2

帖子 lvwengui2010 » 2010-04-08 9:26

找到问题了,原来是我忘了给画布项加一个"expose_event"的事件回调。
回复

回到 “GTK+和QT”