Class: TextViewExample
- Defined in:
- lib/gtk_paradise/examples/gtk3/034_text_view_example.rb
Constant Summary collapse
- FILE =
#
FILE
FILE = ‘/test_file.md’ FILE = ‘/Depot/j/foo.md’
#
'/yo.yml'
Instance Method Summary collapse
-
#initialize(run_already = true) ⇒ TextViewExample
constructor
# === initialize ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
Methods inherited from Gtk::Box
#add_space, #left_aligned_text, #text
Constructor Details
#initialize(run_already = true) ⇒ TextViewExample
#
initialize
#
26 27 28 29 30 31 |
# File 'lib/gtk_paradise/examples/gtk3/034_text_view_example.rb', line 26 def initialize( run_already = true ) super(:vertical) run if run_already end |
Instance Method Details
#run ⇒ Object
#
run
#
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gtk_paradise/examples/gtk3/034_text_view_example.rb', line 36 def run text_buffer = Gtk::TextBuffer.new text_buffer.set_text( "Hello world!\n"*100 ) # ======================================================================= # # The next line is for debugging-purposes on my home setup. # ======================================================================= # if File.exist? FILE text_buffer.set_text(File.read(FILE)) end text_view = Gtk::TextView.new(text_buffer) text_view.set_size_request(1200, 800) scrolled_window = Gtk::ScrolledWindow.new scrolled_window.(text_view) scrolled_window.show_all scrolled_window.set_size_request(800, 600) box = Gtk::Box.new(:vertical) box.add( Gtk::Label.new('Showing a TextView widget next:') ) box.pack_start( scrolled_window, fill: true, expand: true, padding: 8 ) box.add( Gtk::Separator.new(:horizontal) ) box.show_all add(box) show_all end |