How can i set the signal of a GtkTextView to go off on <enter>??



Hi,

I am writing a small instant messenger type program. And in my instant
message window, there are two testview boxes....one to diplay the
conversation, and the other for the user to type in thier input.

Now, there are two things, which I just cant figure out. Currently. When the
user types in the textview box, they much click on a Button, which then
grabs the text in the TextView window. I want to some connect a signal so
that when a user hits <enter> or <ctrl+enter> the text will be grabed from
that window, but I have had a lot of difficulty finding the signals conected
with TextView windows.

The second problem. No matter how hard I try, I just cant get the WORD_WRAP
to work in the TextView in which the user types thier input. I have tried
several methods, such as not allowing the window to be resizable. Which kind
of works. The user can not directly change the size of the window....but if
they keep typing beyond the dimensions of the window, the window just
increases, or if I have the horizontal scrollbar enabled, that goes into
effect. But i want the words to wrap to the next line. Now this is not an
issue for the window which displays the conversation, because it is a lot
easier to just word wrap text as you place it.

Here is a short snipped of my code, and what I have tried, but nothing seems
to work.

 //gtk_window_set_resizable(GTK_WINDOW (window), FALSE);

temp->input = gtk_text_view_new();
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(temp->input), GTK_WRAP_WORD);
temp->typeBuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (temp->input));

//g_signal_connect (G_OBJECT (temp->input), "activate", G_CALLBACK
(button_clicked), (IM *) temp);

sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);


Thanks for the help!

--
Arash Nikkar
arash umail ucsb edu
 
 


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