Class: SKUI::Button
Overview
Instance Attribute Summary
Attributes inherited from Control
Attributes inherited from Base
Instance Method Summary collapse
- #caption ⇒ String
-
#initialize(caption, &on_click) ⇒ Button
constructor
A new instance of Button.
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.
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 |