Sha256: 4dbfcb3a8936535a3365beddda72ce25fd0e71933feaa7d8e54900be6ffbcc19

Contents?: true

Size: 556 Bytes

Versions: 6

Compression:

Stored size: 556 Bytes

Contents

class Location
  attr_accessor :country
  
  def country_options
    %w[USA Canada Mexico Columbia UK Australia Germany Italy Spain]
  end
end

@location = Location.new

include Glimmer

shell {
  text 'Hello, Drag and Drop!'
  list {
    selection bind(@location, :country)
    on_drag_set_data { |event|
      list = event.widget.getControl
      event.data = list.getSelection.first
    }
  }
  label(:center) {
    text 'Drag a country here!'
    font height: 20
    on_drop { |event|
      event.widget.getControl.setText(event.data)
    }
  }
}.open

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
glimmer-dsl-swt-0.6.9 samples/hello/hello_drag_and_drop.rb
glimmer-dsl-swt-0.6.8 samples/hello/hello_drag_and_drop.rb
glimmer-dsl-swt-0.6.7 samples/hello/hello_drag_and_drop.rb
glimmer-dsl-swt-0.6.6 samples/hello/hello_drag_and_drop.rb
glimmer-dsl-swt-0.6.5 samples/hello/hello_drag_and_drop.rb
glimmer-dsl-swt-0.6.4 samples/hello/hello_drag_and_drop.rb