Class: Canis::MenuLink

Inherits:
Link show all
Defined in:
lib/canis/core/widgets/rmenulink.rb

Instance Attribute Summary

Attributes inherited from Widget

#_object_created, #col_offset, #config, #curpos, #focussed, #form, #handler, #id, #key_label, #parent_component, #row_offset, #state

Instance Method Summary collapse

Methods inherited from Link

#fire

Methods inherited from Button

#action, #bind_hotkey, button_layout, #command, #default_button, #fire, #getvalue, #handle_key, #map_keys, #mnemonic, #repaint, #selected?, #text

Methods inherited from Widget

#action_manager, #bgcolor, #changed, #click, #color, #color_pair, #command, #destroy, #enter, #focus, #focusable, #focusable?, #getvalue, #handle_key, #hide, #init_vars, #leave, #modified?, #move, #on_enter, #on_leave, #override_graphic, #process_key, #property_set, #remove, #repaint, #repaint_all, #repaint_required, #rowcol, #set_form, #set_form_col, #set_form_row, #set_modified, #setformrowcol, #setrowcol, #show, #unbind_key

Methods included from Io

#__create_footer_window, #clear_this, #get_file, #print_this, #rb_getchar, #rb_gets, #rb_getstr, #warn

Methods included from Utils

#ORIG_process_key, #ORIGbind_key, #ORIGkeycode_tos, #_process_key, #bind_composite_mapping, #bind_key, #bind_keys, #check_composite_mapping, #create_logger, #define_key, #define_prefix_command, #execute_mapping, #get_attrib, #get_color, #key, #key_tos, #print_key_bindings, #repeatm, #run_command, #shell_out, #shell_output, #suspend, #view, #xxxbind_composite_mapping

Methods included from ConfigSetup

#config_setup, #variable_set

Methods included from EventHandler

#bind, #event?, #event_list, #fire_handler, #fire_property_change, #register_events

Constructor Details

#initialize(form, config = {}, &block) ⇒ MenuLink

Returns a new instance of MenuLink.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/canis/core/widgets/rmenulink.rb', line 7

def initialize form, config={}, &block
  config[:hotkey] = true
  super
  @col_offset = -1 * (@col || 1)
  @row_offset = -1 * (@row || 1)
  # in this case, we wish to use ENTER for firing
  bind_key( KEY_ENTER, "fire" ) { fire }
  # next did not work
  #bind_key( KEY_ENTER, "fire" ) { get_action( 32 ) }
  # next 2 work
  #bind_key( KEY_ENTER, "fire" ) { @form.window.ungetch(32)  }
  #@_key_map[KEY_ENTER] = @_key_map[32]
  #get_action_map()[KEY_ENTER] = get_action(32)
end

Instance Method Details

#getvalue_for_paintObject

added for some standardization 2010-09-07 20:28 alias :text :getvalue # NEXT VERSION change existing text to label



25
26
27
# File 'lib/canis/core/widgets/rmenulink.rb', line 25

def getvalue_for_paint
  "%s      %-12s   -    %-s" % [ @mnemonic , getvalue(), @description ]
end