Module: Wx::Validator::Binding

Included in:
Wx::Validator
Defined in:
lib/wx/doc/validator.rb

Overview

Mixin module providing data binding options for validators.

Instance Method Summary collapse

Instance Method Details

#do_on_transfer_from_window(data) ⇒ Boolean (protected)

Method called with data transferred from window. By default will call the on_transfer_from_window handler if defined. Returns true if successful or none defined.

Parameters:

  • data (::Object)

Returns:

  • (Boolean)


96
# File 'lib/wx/doc/validator.rb', line 96

def do_on_transfer_from_window(data) end

#do_on_transfer_to_window::Object (protected)

Method called to get data to transfer to window. By default will call the on_transfer_to_window handler if defined. Returns the handler’s result if successful. Otherwise returns nil.

Returns:

  • (::Object)


104
# File 'lib/wx/doc/validator.rb', line 104

def do_on_transfer_to_window; end

#on_transfer_from_window(meth = nil) {|data| ... } ⇒ Object

Installs a callback handler to capture the data retrieved from the associated window. The callback handler can be specified as a (name of a) method, a Proc or a block.

Examples:

This can be used to implement data binding like:

class MyValidator < Wx::Validator
  def initialize(data_store)
    @data_store = data_store
    self.on_transfer_from_window :store_data
    self.on_transfer_to_window :load_data
  end
  protected
  def store_data(data)
    @data_store.save_the_data(data)
  end
  def load_data
    @data_store.get_the_data
  end
end
val = MyValidator.new(a_data_store)
win.set_validator(val)

Parameters:

  • meth (String, Symbol, Method, Proc) (defaults to: nil)

    (name of) method or event handling proc; to be supplied when no block is given

Yield Parameters:

  • data (::Object)

    the data retrieved from the window



64
# File 'lib/wx/doc/validator.rb', line 64

def on_transfer_from_window(meth=nil, &block) end

#on_transfer_to_window(meth = nil, &block) ⇒ Object

Installs a callback handler to provide the data to transfer to the associated window. The callback handler can be specified as a (name of a) method, a Proc or a block.

Examples:

This can be used to implement data binding like:

class MyValidator < Wx::Validator
  def initialize(data_store)
    @data_store = data_store
    self.on_transfer_from_window :store_data
    self.on_transfer_to_window :load_data
  end
  protected
  def store_data(data)
    @data_store.save_the_data(data)
  end
  def load_data
    @data_store.get_the_data
  end
end
val = MyValidator.new(a_data_store)
win.set_validator(val)

Parameters:

  • meth (String, Symbol, Method, Proc) (defaults to: nil)

    (name of) method or event handling proc; to be supplied when no block is given

Yield Returns:

  • (::Object)

    the data to transfer to the window



89
# File 'lib/wx/doc/validator.rb', line 89

def on_transfer_to_window(meth=nil, &block) end