(no subject)
- From: Matt Strange <mstrange wans net>
- To: gtk-list gnome org
- Subject: (no subject)
- Date: Sat, 31 Jul 2004 13:59:15 -0700 (PDT)
Hello All,
I am using GTK 2.4.1 and GCC 3.3.3 and am having trouble setting the
GtkProgressBar fraction to low values such as 0.01. When I use these small
values and the orientation is set to either GTK_PROGRESS_BAR_LEFT_TO_RIGHT or
GTK_PROGRESS_BAR_TOP_TO_BOTTOM, the bar displays as _filled_ rather than almost
empty, as it should. The problem is dependent on the size of the widget, if it
is resized larger, the bar will snap back into a correct state. This is always
reproducible and occurs in all gtk applications.
Does anyone know why this might be happening? I modified the ProgressBar
example from the gtk tutorial and it is included below. On my system it
displays as filled, rather than at fraction 0.01. Resizing the window in the
x-direction may change it from the filled to the working state.
Thank you for your time.
#include <gtk/gtk.h>
GtkWidget *window;
void
destroy_progress(GtkWidget *widget)
{
window = NULL;
gtk_main_quit ();
}
int
main( int argc,
char *argv[])
{
GtkWidget *progress;
GtkWidget *vbox;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy_progress),
NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (window), vbox);
progress = gtk_progress_bar_new ();
/* the orientation must be LEFT-TO-RIGHT or TOP-TO-BOTTOM; others are fine */
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (progress),
GTK_PROGRESS_LEFT_TO_RIGHT);
/* the value must be small, but it also depends on the size of the window */
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0.01);
gtk_container_add (GTK_CONTAINER (vbox), progress);
/* 221 is the critical x-value, 122 is the critical y-value in TOP_TO_BOTTOM
mode. larger makes the bar work ok, smaller will cause the same problem.
try resizing the window in the x-directions */
gtk_window_set_default_size(GTK_WINDOW(window), 221, 122);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]