GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Sep 22, 2014 8:18 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Problem in event handler
PostPosted: Wed Oct 25, 2006 2:31 pm 
Offline

Joined: Wed Oct 25, 2006 2:13 pm
Posts: 3
Hi I have created two GtkWidget like this
GtkWidget* set_coverlcd_contrast_vbox = NULL;
GtkWidget* set_coverlcd_contrast_image = NULL;

now my create function is like this ,, In this i have given key press event "contrast_keypressed" to the set_coverlcd_contrast_vbox

create( state_t* pState, gint winAct )
{
state_t* this = (state_t*)pState;
set_coverlcd_contrast_vbox = gtk_fixed_new();gtk_event_box_new ();
gtk_widget_set_size_request (set_coverlcd_contrast_vbox, 240, 216);
gtk_widget_set_events (set_coverlcd_contrast_vbox, GDK_KEY_PRESS_MASK);
gtk_signal_connect(GTK_OBJECT(set_coverlcd_contrast_vbox), "key_press_event",GTK_SIGNAL_FUNC(contrast_keypressed), this);
gtk_fixed_put(GTK_FIXED(WsGetMainArea(this->set_main_window)),set_coverlcd_contrast_vbox, 0,0);

set_coverlcd_contrast_image = gtk_image_new();
gtk_widget_set_size_request (set_coverlcd_contrast_image, 240, 216);
gtk_misc_set_alignment (GTK_MISC (set_coverlcd_contrast_image), 0, 0);
gtk_fixed_put(GTK_FIXED(set_coverlcd_contrast_vbox),set_coverlcd_contrast_image, 0,0);
gtk_widget_show(set_coverlcd_contrast_image);

__psh_set_coverlcd_contrast_loadbmp( this, gpsh_set_coverlcd_contrast_level );
gtk_widget_grab_focus(set_coverlcd_contrast_vbox);
gtk_widget_show(set_coverlcd_contrast_vbox);

}


gboolean
contrast_keypressed( GtkWidget *widget, GdkEventKey *event ,gpointer data )
{

switch( event->keyval)
{
case 65361:
fprintf(stderr, "left keypressed ..\n");
case 65362:
fprintf(stderr, "up keypressed ..\n");
case 65363:
fprintf(stderr, "right keypressed ..\n");
case 65364:
fprintf(stderr, "down keypressed ..\n");
return FALSE;
}

my problem is the event handler is not getting called when i press left,up, right, down keys
what could be the problem??

_________________
regards
Kiran


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 26, 2006 7:53 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Notice this line in your code:

set_coverlcd_contrast_vbox = gtk_fixed_new();gtk_event_box_new ();

_________________
Andrew Krause

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


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

All times are UTC


Who is online

Users browsing this forum: Yahoo [Bot] and 2 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