From: Kristof B. <kr...@vl...> - 2002-07-28 15:02:53
|
Hello. I am developing a small app with ruby/GTK. However, there is a problem when trying to change text in an Entry-box, using the signal "insert-text". The following small code will show the problem. This is an example taken from the gtk - user manual. There it uses the function gtk_block_signal_handler_by_func. This is not available in the ruby-language bindings, so I use a global variable. When a insert text, the text gets there, but the cursor doesn't move. Is there a way to make this work, or do I have change to the c-language? --- begin code ----- require 'gtk' $block = false window = Gtk::Window.new entry = Gtk::Entry.new() window.add(Gtk::VBox.new.add(entry)) entry.signal_connect("insert_text") do |widget, text, pos| if not $block $block = true widget.insert_text(text.upcase, pos) $block = false widget.signal_emit_stop_by_name("insert_text") end end window.show_all Gtk.main --- end code --- |