Problem with Tabs



Hi,
I've had a bit of trouble with tabbing about a Gtk program using GTK1.2.8 and 1.2.10. I used the following program for a simple demonstration of what happened:

#include <gtk/gtk.h>

GtkWidget * window;
GtkWidget * button;

gint timeoutFunc( gpointer data )
{
button = GTK_WINDOW( window )->focus_widget;
printf( "%x\n", button );
}

main( int argc, char * argv[])
{
gtk_init( &argc, &argv );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_widget_show( window );
button = gtk_button_new_with_label( "Test" );
gtk_widget_show( button );
gtk_container_add( GTK_CONTAINER( window ), button );
gtk_window_set_default( GTK_WINDOW( window ), button );
gtk_timeout_add( 1000, timeoutFunc, NULL );
gtk_main();
}


All the program does is create a window with a button in it, and then every second print out the memory location of the currently focused object.

What I find is that when I press tab focus moves to something I can't see and I start getting NULL as the location of the currently focused object. When I don't set the default object for the window, it starts with focus on the null object. Pressing tab again toggles between the null object ans the button.

The same thing happens with more than one object. 5 text entry screens and three buttons tabs through all the entries, all the buttons, then the null object, and back to the first object.

So, does anyone know what I'm doing wrong, or how I can fix this?

Thanks

Scott Burns




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