Re: TextBuffer Help



Tomaz Canabrava a écrit :
this time i will post the code, so i think it will be a little easyer to 
explani my doubt.

problem: Sending text with GINT to the TextBuffer.

Please, take a look at the code below, the onli commented line is the think 
that i wish to do, but i just cant =/

static void Gtk_Insere_Valor( GtkWidget *widget, gpointer data ){
gint Base, Expoente;
GtkSpinButton *spinBase;
GtkSpinButton *spinExpoente;
GtkTextBuffer *Texto_Saida;
GtkTextIter Inicio;
GtkTextIter Fim;

spinBase = GTK_SPIN_BUTTON(g_object_get_data (G_OBJECT (widget), 
"dados_base"));
spinExpoente = GTK_SPIN_BUTTON(g_object_get_data (G_OBJECT (widget), 
"dados_expoente"));
Texto_Saida = GTK_TEXT_BUFFER(g_object_get_data(G_OBJECT(widget), 
"Texto_Dinamico_Debug"));

gtk_text_buffer_get_bounds(Texto_Saida, &Inicio, &Fim);
Base = gtk_spin_button_get_value_as_int(spinBase);
Expoente = gtk_spin_button_get_value_as_int(spinExpoente);

// Instead of printing it on the Console, i wish to send it to the 
TextBuffer.
// How do i do it?
printf("%d %d \n", Base, Expoente); 
}

Maybe you should try sprintf() instead of printf() to format and write
the gint into a string,
then append this string with gtk_text_buffer_insert() into your
gtktextbuffer.





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