Class: Fox::FXComboTableItem

Inherits:
FXTableItem show all
Defined in:
lib/fox16/core.rb

Instance Attribute Summary

Attributes inherited from FXTableItem

#borders, #data, #draggable, #enabled, #focus, #icon, #iconPosition, #justify, #selected, #stipple, #text

Instance Method Summary collapse

Methods inherited from FXTableItem

#create, #destroy, #detach, #draggable?, #draw, #drawBackground, #drawBorders, #drawContent, #drawPattern, #enabled?, #getHeight, #getWidth, #hasFocus?, #selected?, #setIcon, #to_s

Methods inherited from FXObject

#bind, #handle, #load, #save, subclasses

Constructor Details

#initialize(text, ic = nil, ptr = nil) ⇒ FXComboTableItem

Construct new combobox table item



491
492
493
494
# File 'lib/fox16/core.rb', line 491

def initialize(text, ic=nil, ptr=nil)
  super(nil, ic, ptr)
  self.selections = text
end

Instance Method Details

#getControlFor(table) ⇒ Object

Create input control for editing this item



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/fox16/core.rb', line 497

def getControlFor(table)
  combo = FXComboBox.new(table, 1, :opts => COMBOBOX_STATIC, :padLeft => table.marginLeft, :padRight => table.marginRight, :padTop => table.marginTop, :padBottom => table.marginBottom)
  combo.create
  justify = 0
  justify |= JUSTIFY_LEFT   if (self.justify & FXTableItem::LEFT) != 0
  justify |= JUSTIFY_RIGHT  if (self.justify & FXTableItem::RIGHT) != 0
  justify |= JUSTIFY_TOP    if (self.justify & FXTableItem::TOP) != 0
  justify |= JUSTIFY_BOTTOM if (self.justify & FXTableItem::BOTTOM) != 0
  combo.justify = justify
  combo.font = table.font
  combo.backColor = table.backColor
  combo.textColor = table.textColor
  combo.selBackColor = table.selBackColor
  combo.selTextColor = table.selTextColor
  combo.fillItems(selections)
  combo.text = text
  combo.numVisible = [20, combo.numItems].min
  combo
end

#selectionsObject

Return selections



533
534
535
# File 'lib/fox16/core.rb', line 533

def selections
  @selections
end

#selections=(strings) ⇒ Object

Set selections as an array of strings



523
524
525
526
527
528
529
530
# File 'lib/fox16/core.rb', line 523

def selections=(strings)
  @selections = strings
  if @selections.empty?
    self.text = nil
  else
    self.text = @selections[0]
  end
end

#setFromControl(comboBox) ⇒ Object

Set value from input control



518
519
520
# File 'lib/fox16/core.rb', line 518

def setFromControl(comboBox)
  self.text = comboBox.text
end