Re: GtkTextView/GtkTextBuffer
- From: Havoc Pennington <hp redhat com>
- To: Azrael <azrael azrael-uk f2s com>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: GtkTextView/GtkTextBuffer
- Date: Sun, 15 Dec 2002 12:54:32 -0500
On Sun, Dec 15, 2002 at 03:11:26PM +0000, Azrael wrote:
inputBuffer2 = gtk_text_buffer_new(NULL);
textview7 = gtk_text_view_new_with_buffer(inputBuffer2);
gtk_widget_show (textview7);
gtk_container_add (GTK_CONTAINER (scrolledwindow14), textview7);
gtk_signal_connect (GTK_OBJECT (textview7), "activate",
G_CALLBACK(sendToTerm), term);
You should have gotten an error message printed when you ran your
program that GtkTextView has no "activate" signal.
Pressing enter in GtkTextView starts a new line, it's a multi-line
control. The single-line control with an activate signal is GtkEntry.
void sendToTerm(GtkWidget *textArea, GtkWidget *term)
{
GtkTextBuffer *textBuffer = gtk_text_view_get_buffer(textArea);
gint textLength= gtk_text_buffer_get_char_count(textBuffer);
This is wrong; textLength as accepted by vte_terminal_feed() should be
in bytes, not characters.
This is my code currently for sendToTerm() and brings me to several
questions. Firstly I can not work out how I am supposed to obtain the
START and END points of the text in my GtkTextView/Buffer .. but I
/assume/ that I can use 0 for start, and the result of textLength for
END. However these are only ints/gints, and they should be of type
GtkTextIter. Am I missing some obvious function? Assuming I can get this
start/end point, is the above ok?
gtk_text_buffer_get_bounds()
I have added a g_print() to the sendToTerm() function, and it is not
being called at all by use of enter/return key in the GtkTextView, so I
think there must be something wrong with my signal_connect, perhaps it
shouldn't be "activate" at all.. or something else is wrong?
Any advice is most welcome, many thanks
Always read your error messages. ;-)
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]