Trouble setting the value of a GtkAdjustment
- From: Richard Shann <richard rshann plus com>
- To: gtk-app-devel-list gnome org
- Subject: Trouble setting the value of a GtkAdjustment
- Date: Mon, 24 Apr 2017 15:11:06 +0100
Compiling with Gtk 3.14.5
I can't seem to set the "value" of a GtkAdjustment once I have added a widget to it with gtk_container_add(),
it seems to be locked at 0.0
The code looks like this fragment:
8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
GtkAdjustment *ADJ = gtk_adjustment_new (1.5, 0.0, 2.0, 0.01, 0.01, 0.01);
GtkWidget *sw = gtk_scrolled_window_new (ADJ , gtk_adjustment_new (1.5, 0.0, 2.0, 0.01, 0.01, 0.01));
gtk_container_add (GTK_CONTAINER(keyboard_window), sw);
gtk_container_add (GTK_CONTAINER(sw), keyboard);
gtk_adjustment_set_value (ADJ, 1.22222);
g_print ("value %p is %f\n", ADJ, gtk_adjustment_get_value (ADJ));
8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
where keyboard_window is a toplevel GtkWindow, and keyboard is a GtkGrid.
The value printed out is always 0.0 after the widget is added to the scrolled window.
Can anyone help? I'm trying to center the scroll-bars on the window.
Richard Shann
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]