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



560
561
562
563
# File 'lib/fox16/core.rb', line 560

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



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
# File 'lib/fox16/core.rb', line 566

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

#selections ⇒ Object

Return selections



602
603
604
# File 'lib/fox16/core.rb', line 602

def selections
  @selections
end

#selections=(strings) ⇒ Object

Set selections as an array of strings



592
593
594
595
596
597
598
599
# File 'lib/fox16/core.rb', line 592

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



587
588
589
# File 'lib/fox16/core.rb', line 587

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