GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Send mouse button press event to widget??

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
eminemence



Joined: 29 Aug 2007
Posts: 3

PostPosted: Thu Aug 30, 2007 9:08 am    Post subject: Send mouse button press event to widget?? Reply with quote

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: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11

            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.
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 387
Location: Fairfax, Virginia

PostPosted: Thu Aug 30, 2007 10:43 pm    Post subject: Reply with quote

Use g_signal_emit_by_name(). Your widget already has that signal installed if you derive it from GtkWidget.
Back to top
eminemence



Joined: 29 Aug 2007
Posts: 3

PostPosted: Mon Sep 03, 2007 6:48 am    Post subject: Reply with quote

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.
Back to top
eminemence



Joined: 29 Aug 2007
Posts: 3

PostPosted: Mon Sep 03, 2007 10:17 am    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP