mihajlv
mihajlv

Reputation: 2315

How to detect a mouse click or button pressed event on a container in gtk?

I tried with this but the signal is not detected. Does anyone know how to do this or at least some pointers to references. Thanks.

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" ); 
}

Upvotes: 0

Views: 1468

Answers (1)

mihajlv
mihajlv

Reputation: 2315

You need to put the container in an event_box, otherwise it won't detect events since it doesn't have its own window.

Upvotes: 1

Related Questions