2012-06-30 71 views
0

我試過這個,但沒有檢測到信號。有誰知道如何做到這一點,或至少有一些指向引用。謝謝。如何在gtk中的容器中檢測鼠標單擊或按鈕按下事件?

fixed = gtk_fixed_new(); 
    g_signal_connect(G_OBJECT(fixed), "button-press-event", G_CALLBACK(fixed_clicked), NULL); 

void fixed_clicked(GtkWidget *widget, gpointer data) 
{ 
    gtk_statusbar_push(GTK_STATUSBAR(statusBar), 0, "I cliked the fixed layout"); 
} 
+0

你是否在widget的事件掩碼中啓用了按鈕事件? – ptomato

回答

1

你需要把容器在event_box,否則將無法檢測到的事件,因爲它沒有自己的窗口。

相關問題