class EntryBufferDemo
Entry/Entry Buffer¶ ↑
Gtk::EntryBuffer
provides the text content in a Gtk::Entry
. Applications can provide their own buffer implementation, e.g. to provide secure handling for passwords in memory.
Public Class Methods
new(main_window)
click to toggle source
# File gtk3/sample/gtk-demo/entry_buffer.rb, line 12 def initialize(main_window) @window = Gtk::Window.new(:toplevel) @window.screen = main_window.screen @window.title = "Entry Buffer" @window.resizable = false vbox = Gtk::Box.new(:vertical, 5) vbox.margin = 5 @window.add(vbox) label = Gtk::Label.new markup = "Entries share a buffer. Typing in one is reflected in the other." label.markup = markup vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) # Create the buffer that will be shared buffer = Gtk::EntryBuffer.new # first entry entry = Gtk::Entry.new(buffer) vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0) # second entry entry = Gtk::Entry.new(buffer) vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0) end
Public Instance Methods
run()
click to toggle source
# File gtk3/sample/gtk-demo/entry_buffer.rb, line 39 def run if !@window.visible? @window.show_all else @window.destroy end end