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 

Problem in event handler

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



Joined: 25 Oct 2006
Posts: 3

PostPosted: Wed Oct 25, 2006 2:31 pm    Post subject: Problem in event handler Reply with quote

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


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

PostPosted: Thu Oct 26, 2006 7:53 pm    Post subject: Reply with quote

Notice this line in your code:

set_coverlcd_contrast_vbox = gtk_fixed_new();gtk_event_box_new ();
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