Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] GTK List is done


Ok, I've gone through GTK List and it's looking good.  There is an outstanding problem
in List.setTopIndex() and List.showSelection() that I belive is a bug in GTK.  It seems that
gtk_clist_moveto() doesn't like to be called before the top level shell is opened.  On to
the next class - Tree!

Here is some code that shows the problem:

public static void main (String [] args) {
        OS.gtk_init_check (new int [] {0}, null);
        int shell = OS.gtk_window_new (OS.GTK_WINDOW_TOPLEVEL);
        int scroll = OS.gtk_scrolled_window_new (0, 0);
        OS.gtk_container_add (shell, scroll);
        int clist = OS.gtk_clist_new (1);
        OS.gtk_container_add (scroll, clist);
        for (int i=0; i<10; i++) {
                byte [] buffer = {(byte)'H',(byte) 'i', (byte) '-', (byte) (i + '0'), 0};        
                int ptr = OS.g_malloc (buffer.length);
                OS.memmove (ptr, buffer, buffer.length);
                int result = OS.gtk_clist_append (clist, new int [] {ptr});
                OS.g_free (ptr);
        }
        OS.gtk_widget_show (clist);
        OS.gtk_widget_show (scroll);
       
//        WORKS
//        OS.gtk_widget_show (shell);
//        OS.gtk_clist_moveto (clist, 5, 0, 0.0f, 0.0f);

//        FAILS
        OS.gtk_clist_moveto (clist, 5, 0, 0.0f, 0.0f);
        OS.gtk_widget_show (shell);
       
        while (true) OS.gtk_main_iteration ();
}

Back to the top