[Glade-users] Equation Examples



Wayne,




My base " C " code displays the following:


  printf("\nM-2-C: %.3f, m* exp(2.1463 - (.3807 * log (g)));


So far I have not been able to replicate this in GTK code.

What you need to do is print this into a char string, and then set the 
char string to the label.

For instance

gchar *my_string;

my_string  = g_strdup_printf("\nM-2-C: %.3f, m* exp(2.1463 - (.3807 * 
log (g))", variable, variable, variable);

gtk_label_set_text(GTK_LABEL(my_label), my_string);


Notice I'm using glib utilities,  gchar, g_strdup_printf() etc.  They 
are very useful indeed, but you can probably dispense with the 
my_string variable and put the g_strdup_printf right in the 
gtk_label_set_text() function.  I just wanted to show it the formal 
way.  Help files and details on these are available at the developer 
section of gnome.org, or gtk.org.  Note that you have to free the 
result of the g_strdup_printf(), when it's no longer needed.

Cheers,

Rikke




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