Sha256: 6e19cfbb8607afcaea947ff919295546d175bf4e7e9724ca045557d3321e6ae2
Contents?: true
Size: 1.3 KB
Versions: 106
Compression:
Stored size: 1.3 KB
Contents
# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # =begin = Entry/Entry Completion GtkEntryCompletion provides a mechanism for adding support for completion in GtkEntry. =end class EntryCompletionDemo def initialize(main_window) @window = Gtk::Window.new(:toplevel) @window.screen = main_window.screen @window.title = "Entry Completion" @window.resizable = true vbox = Gtk::Box.new(:vertical, 5) vbox.margin = 5 @window.add(vbox) label = Gtk::Label.new markup = "Completion demo, try writing <b>total</b> or <b>gnome</b> for example." label.markup = markup vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) entry = Gtk::Entry.new vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0) completion = Gtk::EntryCompletion.new entry.completion = completion completion.model = create_completion_model completion.text_column = 0 end def run if !@window.visible? @window.show_all else @window.destroy end @window end private def create_completion_model store = Gtk::ListStore.new(String) %w(GNOME total totally).each do |word| iter = store.append iter[0] = word end store end end
Version data entries
106 entries across 106 versions & 1 rubygems