Sha256: ddf797c562d1fadc2e0c9a17c71ec55ff1ea4768c565be067c898d89997ce9da

Contents?: true

Size: 1.3 KB

Versions: 19

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)
    @window.add(vbox)
    vbox.border_width = 5

    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

19 entries across 11 versions & 2 rubygems

Version Path
savant-echo-1.0.4 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-1.0.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-1.0.1 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-1.0.1 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.91 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.91 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.9 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.9 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.6 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.6 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.5 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.5 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.4 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.3 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
savant-echo-0.1.3 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/entry_completion.rb
gtk3-3.1.0-x64-mingw32 sample/gtk-demo/entry_completion.rb
gtk3-3.1.0-x86-mingw32 sample/gtk-demo/entry_completion.rb
gtk3-3.1.0 sample/gtk-demo/entry_completion.rb