Ruby-gtk, Gtk::Text question 
Author Message
 Ruby-gtk, Gtk::Text question

Hi,
What should I do to make my Gtk::Text widget accept keyboard input without
need of clicking on it first?

Is there any specific Ruby-gtk list?
--
Jacek Podkanski



Fri, 25 Feb 2005 19:40:42 GMT  
 Ruby-gtk, Gtk::Text question
Am Mon, 2002-09-09 um 13.51 schrieb Jacek Podkanski:

Quote:
> Hi,
> What should I do to make my Gtk::Text widget accept keyboard input without
> need of clicking on it first?

try             text.set_editable(true)
                text.grab_focus

Quote:

> Is there any specific Ruby-gtk list?

there is a gnome-list on sourceforge.net

Quote:
> --
> Jacek Podkanski

Harald Gro?e


Fri, 25 Feb 2005 20:07:41 GMT  
 Ruby-gtk, Gtk::Text question
Hi,

On Mon, 9 Sep 2002 21:05:54 +0900

Quote:

> Am Mon, 2002-09-09 um 13.51 schrieb Jacek Podkanski:
> > Hi,
> > What should I do to make my Gtk::Text widget accept keyboard input without
> > need of clicking on it first?

> try                text.set_editable(true)
>            text.grab_focus

> > Is there any specific Ruby-gtk list?

> there is a gnome-list on sourceforge.net

See http://sourceforge.net/projects/ruby-gnome/

--



Fri, 25 Feb 2005 20:31:59 GMT  
 Ruby-gtk, Gtk::Text question

Quote:

> Am Mon, 2002-09-09 um 13.51 schrieb Jacek Podkanski:
>> Hi,
>> What should I do to make my Gtk::Text widget accept keyboard input
>> without need of clicking on it first?

> try           text.set_editable(true)
> text.grab_focus

Sorry, but it didn't work. Below is a program I'm trying to write.

################################################################
#!/usr/bin/ruby

require 'gtk'
class Status_bar < Gtk::Label
  def initialize(vbox,m='')


  end
  def message(m)

  end
end#class
class Text
  def initialize(vbox)



    #######################################################################

    #t='ala ma kota'



      $com.set_status('you pressed key *** '+e.keyval.to_s)

    }

  end
end#class
class Menu
  def initialize(vbox)
    #super 'menu will go here'


    menubaritem = Gtk::MenuItem.new("File")

    filemenu=Gtk::Menu.new#menu under 'File' that contains 'Quit' item
    menubaritem.set_submenu(filemenu)

    quit=Gtk::MenuItem.new('Quit')
    filemenu.append(quit)
    quit.signal_connect("button_press_event") {
      puts 'you pressed Menu/File/Quit'    
      $com.quit
    }

    help=Gtk::MenuItem.new('Help')

    helpmenu=Gtk::Menu.new
    help.set_submenu(helpmenu)

    about=Gtk::MenuItem.new 'About'
    helpmenu.append(about)
    about.signal_connect("button_press_event") {
      $com.set_status('Author: Jacek Podkanski')
    }
  end
end#class
class Toolbar
def initialize(vbox)


end
end#class
class Com
  #program in such way that you don't need --> attr_reader :ed

  def quit
    puts 'quitting'; exit
  end
  def set_status(m='')

  end
end#class
###################################################################
class Edytorek
  attr_reader :status
  def initialize
    $com=Com.new(self)
    window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL)
    window.set_title('edytorek')
    window.signal_connect("delete_event") { $com.quit }
    window.signal_connect("destroy_event") { $com.quit }
    #window.signal_connect("key_press_event") {|w,e|
      #  $com.set_status('Nacisnales klawisz '+e.keyval.to_s)
      #}
    vbox=Gtk::VBox.new()
    window.add(vbox)





    $com.set_status('statusbar will go here...')

    window.show_all
    #window.set_default_size( 200,200 )
    window.set_uposition( 0,0 )
    Gtk::main()
  end#def
end#class
if $0==__FILE__
  Edytorek.new
end
######################################################
--
Jacek Podkanski



Sat, 26 Feb 2005 00:45:38 GMT  
 Ruby-gtk, Gtk::Text question
Hi,

Quote:


>> Am Mon, 2002-09-09 um 13.51 schrieb Jacek Podkanski:
>>> Hi,
>>> What should I do to make my Gtk::Text widget accept keyboard input
>>> without need of clicking on it first?

>> try           text.set_editable(true)
>> text.grab_focus

> Sorry, but it didn't work. Below is a program I'm trying to write.


Quote:
> class Text
>   def initialize(vbox)



>     #######################################################################

>     #t='ala ma kota'



>       $com.set_status('you pressed key *** '+e.keyval.to_s)

>     }

>   end
> end#class

Context diff:




-    #######################################################################

     #t='ala ma kota'


     }


   end
 end#class
 class Menu
=======================================================

--
KUBO Takehiro



Sat, 26 Feb 2005 02:29:21 GMT  
 Ruby-gtk, Gtk::Text question
Thank you very much! I wonder sometimes why things seem so simple once you
are shown solution.

As you see, I'm trying to write simple editor in ruby. Any suggestions?

Quote:
> Hi,



>>> Am Mon, 2002-09-09 um 13.51 schrieb Jacek Podkanski:
>>>> Hi,
>>>> What should I do to make my Gtk::Text widget accept keyboard input
>>>> without need of clicking on it first?

>>> try           text.set_editable(true)
>>> text.grab_focus

>> Sorry, but it didn't work. Below is a program I'm trying to write.


>> class Text
>>   def initialize(vbox)



>>     #################################

#######################################################################

- Show quoted text -

Quote:

>>     #t='ala ma kota'



>>       $com.set_status('you pressed key *** '+e.keyval.to_s)

>>     }

>>   end
>> end#class

> Context diff:
> =======================================================




> #################################
> -  
> #######################################################################

>      #t='ala ma kota'



>      }


>    end
>  end#class
>  class Menu
> =======================================================

Regards,
--
Jacek Podkanski


Sat, 26 Feb 2005 03:07:49 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Ruby/Gtk, Text widget question

2. Now parsing gtk/gtk.h

3. GTK an GTK ada problemes

4. cl-gtk for gtk+-1.2

5. Ruby/Gtk : question on menus

6. Ruby/Gtk question

7. Ruby/GTK question and future RAA suggestions

8. string.c (str_alloc) ruby 1.8 + ruby-gtk crash

9. Ruby-GTK / Ruby-glade problems

10. Ruby/GTK: example needed of Widget written in Ruby

11. Ruby on a PDA -- GTk/Ruby ??

12. Seeking news/status about Ruby/Gtk and Glade/Ruby

 

 
Powered by phpBB® Forum Software