GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Nov 29, 2014 5:03 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Send mouse button press event to widget??
PostPosted: Thu Aug 30, 2007 9:08 am 
Offline

Joined: Wed Aug 29, 2007 6:07 am
Posts: 3
Hi All,
Am a newbie to linux gtk programming.I want trying to send the mouse button press event to my widget and so I tried this code:
Code:
         guint signalid = g_signal_new("button_press_event",
                                 G_TYPE_FUNDAMENTAL(0),
                                 G_SIGNAL_RUN_FIRST,
                                 NULL,
                                 NULL,
                                 NULL,
                                 NULL,
                                 G_TYPE_NONE,0);
         g_signal_emit(GTK_OBJECT(gPage),signalid,0);

Can someone tell me what is wrong out there?
Thanks in advance.
--eminemence.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 10:43 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Use g_signal_emit_by_name(). Your widget already has that signal installed if you derive it from GtkWidget.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 03, 2007 6:48 am 
Offline

Joined: Wed Aug 29, 2007 6:07 am
Posts: 3
I have tried it already but it gives a Segmentation fault!!
I have now even tried gdk_event_put but nothing seems to work.
--eminemence.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 03, 2007 10:17 am 
Offline

Joined: Wed Aug 29, 2007 6:07 am
Posts: 3
I have used gtk_widget_event and it is posting the GDK_PRESS_EVENT properly.
But if i post PRESS and RELEASE events in succession only PRESS event is posted to the widget.the RELEASE event seems to vanish somewhere.
Any clues as to why this is happening.
--eminemence.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group