Re: Updating displayed spinbutton value from a text file



On Wed, 4 Jul 2018, Roger Matthews via gtk-app-devel-list wrote:

    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);

Try

gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_drawingparameter1),...

You have a broken attempt at a cast.

--
Allin Cottrell
Department of Economics
Wake Forest University


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