Re: need a multi line text widget to respond to 'ENTER'

On Thu, 2002-12-19 at 06:38, Havoc Pennington wrote:
On Thu, Dec 19, 2002 at 03:29:28AM +0000, Azrael wrote: 
I have tried to find out more aboutgtk_widget_add_accelerator, and what
sort of arguments it wants in order to do what I want.. but (obviously)
have had no success.

If anyone can help, it would be appreciated! 

You are making this way too complicated - just connect to
key_press_event, and check event->keyval == GDK_Enter.

Ahh.. that's the sort of thing I wanted :) Thank you!!

In a previous e-mail you suggested:

for: 'vte_terminal_feed(x,y, textlength)' textlength should be in bytes,
not characters.

I currently have:

gint textLength= gtk_text_buffer_get_char_count(textBuffer);
GtkTextIter start, end;
gtk_text_buffer_get_end_iter(textBuffer, &end);
gtk_text_buffer_get_start_iter(textBuffer, &start);
char *textContent = gtk_text_buffer_get_text(textBuffer, &start, &end,
vte_terminal_feed(VTE_TERMINAL(term), textContent, (glong)textLength);

Which is still wrong as per your comment. However, it does send the full
text to the terminal. Perhaps this is just coincidence.. However it
isn't working exactly as I would expect (perhaps because I should use
bytes not characters) in that while the full text is sent through to the
vte, it isn't sending an 'endline/return' character through.
That is it is as if I typed the text directly into the terminal without
pressing enter.

I therefore considered sending an 'enter' through automatically in the
bottom of the above function. But wasn't sure what to send. Initial
ideas to send "\n" or "\r" (and "\n\r" or "\r\n" all possible
combinations) didn't do the tick.. and in fact i didn't expect them to.
I also tried to send through 0xFF0D which is the code for GDK_Return,
but that didn't work either.

Does anyone have any good ideas to beat ideas into my head?
(An I am currently unable to buy a book on gtk for 2 reasons. (1) short
on money. (2) I already bought one a few years ago, and I /can't/ find
it! :( )

Many thanks to one and all :)


           `0_ O  )   `-.  (     ).`-.__.`) 
           (_Y_.)'  ._   )  `._ `. ``-..-'  
         _..`--'_..-_/  /--'_.' .'          
        ((i).-''  ((i).'  (((.-'         
Of all God's creatures there is only one that cannot be made the slave
of the lash. That one is the cat. If man could be crossed with a cat it
would improve man, but it would deteriorate the cat. 


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