Updating displayed spinbutton value from a text file



     I'm using gtk+3.10 on Ubuntu 14.04 and am writing an application in C, with the user interface 
constructed with a builder.ui file. I am using spinbuttons to create and change Cairo drawings of some 
mathematical functions. The spinbuttons’ adjustment value is initialised from the builder.ui file and can 
then can be changed with the spinbutton, I also read values from a text file to create and change the 
drawings, which after being read from the file (containing many drawing parameters) these parameters are then 
written to seperate files for each parameter which are then read into the drawing function in drawing.c, 
which is compiled together with mymain.c.
     This works ok (the drawings change), except that when reading the values from the file I would also like 
to update the values displayed in the spinbuttons so that they match those in the file and with the correctly 
updated drawings.
     I have tried using the following, taken from Foundations of GTK+ Development, by Andrew Krause (gtk+2):

gtk_spin_button_set_value (GtkSpinButton *spin_drawingparameter1, int drawingparameter1);

in the callback for the spinbutton *spin_readfile (which makes the choice between reading/not reading the 
file).

When attempting to compile I receive this error message:

mymain.c: In function ‘callback_readfile’:
mymain.c:1124:28: error: expected expression before ‘GtkSpinButton’
 gtk_spin_button_set_value (GtkSpinButton *spin_drawingparameter1, int drawingparameter1);
                            ^
mymain.c:1124:28: error: too few arguments to function ‘gtk_spin_button_set_value’
In file included from /usr/include/gtk-3.0/gtk/gtk.h:176:0,
                 from mymain.c:9:
/usr/include/gtk-3.0/gtk/gtkspinbutton.h:197:7: note: declared here
 void  gtk_spin_button_set_value    (GtkSpinButton  *spin_button,
       ^
make: *** [mymain] Error 1

The first error I don't know what I need to do at all, while the second error may be related to the gtk+ 
version, or it might not....
Can this be done in my builder.ui file, perhaps with “change-value”?

Any help would be greatly appreciated,
Thanks,
Roger Matthews



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