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 May 18, 2013 6:06 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: simulate GtkButton click event programmatically
PostPosted: Wed Sep 07, 2011 12:25 pm 
Offline
Familiar Face

Joined: Fri Jun 24, 2011 12:04 pm
Posts: 16
HI,

I have a GtkButton,
I have done gtk_widget_set_state() and gtk_widget_grab_focus() on that button.
also I have connected "button-press-event" and "button-release-event" signal on that button.
I need to simulate click event when keyboard "enter" is pressed.
I have connected key_press_event and key_release_event as well

can anybody let me know how to do it??

Regards,
limitless


Top
 Profile  
 
 Post subject: Re: simulate GtkButton click event programmatically
PostPosted: Wed Sep 07, 2011 5:57 pm 
Offline
GTK+ Guru

Joined: Sun Apr 06, 2008 6:43 pm
Posts: 273
Location: Fortress of solitude
Does gtk_button_clicked help?

_________________
* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM Archlinux with xfce.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM Host: Debian squeeze/backports with xfce; Guest: ArchLinux.


Top
 Profile  
 
 Post subject: Re: simulate GtkButton click event programmatically
PostPosted: Thu Sep 08, 2011 6:39 am 
Offline
Familiar Face

Joined: Fri Jun 24, 2011 12:04 pm
Posts: 16
Hi Joel,

thanks for ur reply.
gtk_button_clicked will emit clicked signal

I want to emit "button-press-event" and "button-release-event"

Regards,
limitless


Top
 Profile  
 
 Post subject: Re: simulate GtkButton click event programmatically
PostPosted: Thu Sep 08, 2011 1:40 pm 
Offline
Familiar Face

Joined: Fri Jun 24, 2011 12:04 pm
Posts: 16
I resolved it.
did a g_signal_emit_by_name()
ny ways thanks Joel, I just looked it into that gtk_button_clicked() implementation to get the idea

Regards,
Limitless


Top
 Profile  
 
 Post subject: Re: simulate GtkButton click event programmatically
PostPosted: Fri Sep 09, 2011 6:35 pm 
Offline
GTK+ Guru

Joined: Sun Apr 06, 2008 6:43 pm
Posts: 273
Location: Fortress of solitude
Glad to help :)

_________________
* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM Archlinux with xfce.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM Host: Debian squeeze/backports with xfce; Guest: ArchLinux.


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group