PDA

View Full Version : [SOLVED] Click event for GtkDrawingArea



PaulM1985
April 24th, 2010, 11:59 AM
Hi

I am using a GtkDrawingArea with xine to create a video screen. I want to add events so that I can click on the screen and this will toggle whether the media controls are visible or not. So far I have used:



void onScreenClicked(GtkWidget *widget, gpointer data) {
std::cout << "screen clicked" << std::endl;
}

// in my method initialising everything
g_signal_connect(userInterface.vidScreen, "clicked",
G_CALLBACK(onScreenClicked),&(userInterface.xine));


The problem I am having is when I run the program I get:

(<unknown>:5499): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.22.3/gobject/gsignal.c:2270: signal `clicked' is invalid for instance `0x8138858'

I am guessing this is because the area cannot accept click events. Is there no way to add one?

Paul

simeon87
April 24th, 2010, 12:37 PM
I'm using "button_press_event" as signal in my Gtk program in Python so the error message is correct: the "clicked" signal is not valid. If that doesn't work, you can also try "button-press-event".

PaulM1985
April 24th, 2010, 01:03 PM
Thanks. Thats work.