about GdkEventFocus and ...........?



hello,
anyone could tell me two member variables of meaning in struct GdkEventFocus of gtk source code.
source code as following:
struct _GdkEventFocus
{
   GdkEventType type;
   GdkWindow *window;
   gint8 send_event;  ----------->what meaning?
   gint16 in;   ---------------------->what meaning?
}

why i want to ask that question.
for i want to control the buttons focus move with keyboard (not by mouse) in a gtktable not by the default done .
anyone find that you couldn't move Parallelly the buttons focus in two tables ,and you move buttons focus with  up-down-left-right key in one table sometime not as you expected.

the following code is the problem about the buttons focus move in one table,you can test it with up-down-left-right key then see the focus is at the button as you expected.

/*file  ProblemInOneTable.c  */
#include <gtk/gtk.h>

gint delete_event( GtkWidget *widget, GdkEvent  *event,gpointer   data )
{
    gtk_main_quit ();
    return(FALSE);
}

int main( int   argc,char *argv[] )
{
    GtkWidget *window;
    GtkWidget *table;
    GtkWidget *button1,*button2,*button3,*button4,*button5,*button6,*button7,*button8;
  
    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Table");
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (delete_event), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 20);

    table = gtk_table_new (4,4, TRUE);
    gtk_container_add (GTK_CONTAINER (window), table);

    button1 = gtk_button_new_with_label ("button 1");
    gtk_table_attach_defaults (GTK_TABLE(table), button1, 0, 1, 0, 1);
    gtk_widget_show (button1);

    button2 = gtk_button_new_with_label ("button 2");-------------------focus moves with down key not as expected?
     gtk_table_attach_defaults (GTK_TABLE(table), button2, 1, 2, 0,1);
    gtk_widget_show (button2);

    button3 = gtk_button_new_with_label ("button 3");
     gtk_table_attach_defaults (GTK_TABLE(table), button3, 2, 3, 0, 1);
    gtk_widget_show (button3);

    button4 = gtk_button_new_with_label ("button 4");------------------focus moves with down key not as expected?
     gtk_table_attach_defaults (GTK_TABLE(table), button4, 3, 4, 0,1);
    gtk_widget_show (button4);

    button5 = gtk_button_new_with_label ("button 5");
     gtk_table_attach_defaults (GTK_TABLE(table), button5, 0, 1, 1, 2);
    gtk_widget_show (button5);

    button6 = gtk_button_new_with_label ("button 6");
      gtk_table_attach_defaults (GTK_TABLE(table), button6, 1, 4, 1, 2);
    gtk_widget_show (button6);

    button7 = gtk_button_new_with_label ("button 7");
    gtk_table_attach_defaults (GTK_TABLE(table), button7, 0,2,2, 3);
    gtk_widget_show (button7);

    button8 = gtk_button_new_with_label ("button 8");
    gtk_table_attach_defaults (GTK_TABLE(table), button8, 2, 4, 2, 3);
    gtk_widget_show (button8);

   gtk_widget_show_all(window);
   gtk_main();
   return 0;
}


someone knows this problem?
Thanks in advance!
kason



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]