Class: SKUI::Button

Inherits:
Control show all
Defined in:
src/SKUI/button.rb

Overview

Since:

  • 1.0.0

Instance Attribute Summary

Attributes inherited from Control

#rect

Attributes inherited from Base

#properties, #window

Instance Method Summary collapse

Methods inherited from Control

#enabled, #left, #name, #position, #release, #size, #stretch, #tab_index, #tooltip, #visible, #width, #z_index

Methods inherited from Base

#background_color, #font, #foreground_color, #inspect, #parent, #release, #to_js, #typename, #ui_id

Methods included from Events

#add_event_handler, included, #release_events, #trigger_event

Constructor Details

#initialize(caption, &on_click) ⇒ Button

Returns a new instance of Button.

Parameters:

  • caption (String)
  • on_click (Proc)

Since:

  • 1.0.0



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'src/SKUI/button.rb', line 20

def initialize( caption, &on_click )
  super()

  # Default size based on Window UX guidelines.
  #
  # http://msdn.microsoft.com/en-us/library/aa511279.aspx#controlsizing
  # http://msdn.microsoft.com/en-us/library/aa511453.aspx#sizing
  #
  # Actual:  75x23
  # Visible: 73x21
  @properties[ :width ]  = 75
  @properties[ :height ] = 23

  @properties[ :caption ] = caption

  if block_given?
    add_event_handler( :click, &on_click )
  end
end

Instance Method Details

#captionString

Returns:

  • (String)

Since:

  • 1.0.0



11
# File 'src/SKUI/button.rb', line 11

prop( :caption, &TypeCheck::STRING )