Sha256: 149d4cb96f4ad294e8943a84267b772ea19c50dd952d4ca80d744eb7666fba2d

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

module Nebula
  # This modules just configures Glimmer to work with Nebula CDateTime
  module CDateTime    
    include Glimmer

    Glimmer::SWT::TableProxy.editors[:c_date_time] ||= {
      widget_value_property: :selection,
      editor_gui: lambda do |args, model, property, table_proxy|      
        args << CDT::DROP_DOWN if args.empty?
        table_editor_widget_proxy = c_date_time(*args) {
          table_proxy.table_editor.minimumHeight = 20
          selection model.send(property)
          focus true
          on_focus_lost {
            table_proxy.finish_edit!
          }
          on_key_pressed { |key_event|
            if key_event.keyCode == swt(:cr)
              table_proxy.finish_edit!
            elsif key_event.keyCode == swt(:esc)
              table_proxy.cancel_edit!
            end
          }
          on_widget_selected { |event|
            table_proxy.finish_edit!
          }
          on_widget_default_selected { |event|
            table_proxy.finish_edit!
          }
        }
        table_editor_widget_proxy
      end
    }    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glimmer-cw-cdatetime-nebula-1.4.0.0 lib/views/nebula/c_date_time.rb