Timely Display of Dialog Contents




I have an issue where the contents of a dialog (a label & pic) is not always displayed in a timely manner (or at all). In the code below the dialog outline (the size of the dialog changes from pic to pic) always displays properly as it should. But the contents of the label and the pic in the gtk_image_new_from_pixbuf() call sometimes display appropriately and sometimes don't. (When the dialog content doesn't display properly the dialog outline displays but the contents are blank.)

The code below is within a large loop. There's a lot of other stuff going on. The contents of the dialog (label & pic) changes with each execution of the code. If I slow down execution of the entire code with sleep() I get the same results as described above.

The code below is executed within a g_idle_add().

I've tried adding:
while (gtk_events_pending ())
    gtk_main_iteration ();

after the gtk_widget_show_all() to no avail.

I appreciate any insight.


    batterpicwin = gtk_dialog_new ();
    gtk_window_set_title (GTK_WINDOW (batterpicwin), "Batter Pic");
    gtk_window_set_default_size (GTK_WINDOW (batterpicwin), 200, 130);
    gtk_window_move (GTK_WINDOW (batterpicwin), batpicwinlocX, batpicwinlocY);
    gtk_signal_connect (GTK_OBJECT (batterpicwin), "delete_event", GTK_SIGNAL_FUNC (donot_delete_event), 0);

    strcpy (&work[0], "Batting - ");
    strcat (&work[0], &savebattername[0]);

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (batterpicwin)->vbox), vbox2, TRUE, TRUE, 0);
    label = g_object_new (GTK_TYPE_LABEL, "label", &work[0], NULL);
    gtk_box_pack_start (GTK_BOX (vbox2), label, TRUE, TRUE, 0);

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (batterpicwin)->vbox), vbox2, TRUE, TRUE, 0);

    picbox = gtk_event_box_new ();
    gtk_container_add (GTK_CONTAINER (picbox), gtk_image_new_from_pixbuf (pic));
    gtk_box_pack_start (GTK_BOX (vbox2), picbox, TRUE, TRUE, 0);

    gtk_widget_show_all (batterpicwin);


--
Marshall Lake -- mlake mlake net -- http://www.mlake.net


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