Re: Bug in gtk_edtiable_select_region key_press_event signal



On 11 Apr 2001 17:20:39 -0400, Owen Taylor wrote:

 
> I thinl the right psuedo-code is,
> 
>  - connect to the key press with gtk_signal_connect (not after), 
> 
>  - In the signal handler, do:
> 
>     - If the key press was a ')'
>        - Block yourself
>        - Call gtk_widget_event() with the event event passed in
>        - Unblock yourself
>        - Select the preceeding () pair
>        - [ For GTK+-1.2 ] call gtk_signal_emit_stop_by_name()
>        - return TRUE
>     - Otherwise
>        - return FALSE
Making some changes to your suggestion the stupid case I mentioned early now
works:

 (define (text-cb text ev)
       (if (= (gdk-event-keyval ev) 41)
	   (call-with-dynamic-root
	    (lambda ()		  
	      (gtk-text-insert text #f #f #f ")" -1)
	      (gtk-editable-select-region text 0 2)
	      (gtk-signal-emit-stop-by-name text "key_press_event"))
	    (lambda (errcode) errcode))
	   #f))
 
I removed the call to gtk_widget_event and added the call
to gtk_text_insert and it works right now. Still think this is a hacky
solution but will do for now. I will try to use it in guile-repl
with a more complicated environment. 

ariel
 




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