William B. Parsons
2009-Jan-07 22:22 UTC
[fxruby-users] selective disabling of text entry in a FXTable
Hello, I''m working on my first application using FXRuby, and am trying to disable text entry in certain columns of a FXTable, but calling disableItem() on a cell doesn''t seem to prevent editing a cell. Do I misunderstand the use of disableItem()? The following test program illustrates what I''m trying to do: ---------------------------- #!/usr/bin/env ruby require ''fox16'' include Fox class TestTable < FXTable def initialize(p, title) super(p, :opts => LAYOUT_FILL|HSCROLLING_OFF) setTableSize(0, 3) column_label = [ "A", "B", "C" ] column_label.each_index { |i| setColumnText(i, column_label[i]) } connect(SEL_KEYRELEASE) do |sender, selector, event| puts "cell #{currentRow}, #{currentColumn} "+ "#{itemEnabled?(currentRow, currentColumn)?''en'':''dis''}abled" end end def add_row(label) n = getNumRows insertRows(n) setRowText(n, label) disableItem(n, 2) end end class TopLevelWindow < FXMainWindow def initialize(app) super(app, ''Test'', :width => 400, :height => 90) w = TestTable.new(self, "Test") w.add_row("X") w.add_row("Y") w.add_row("Z") end def create super show(PLACEMENT_SCREEN) end end FXApp.new(''Test'', ''Wikareia'') do |app| TopLevelWindow.new(app) app.create app.run end -- William B. Parsons <wbparsons at cshore.com>
Lyle Johnson
2009-Jan-09 20:07 UTC
[fxruby-users] selective disabling of text entry in a FXTable
On Jan 7, 2009, at 4:22 PM, William B. Parsons wrote:> I''m working on my first application using FXRuby, and am trying to > disable > text entry in certain columns of a FXTable, but calling > disableItem() on > a cell doesn''t seem to prevent editing a cell. Do I misunderstand > the use > of disableItem()?This appears to be a bug in FOX (so I''m Cc''ing the FOX list). Looking at the source code for FXTable, I see a few checks on the enabled/ disabled state of table items, to determine whether or not they can be added to a selection, but that seems to be it.