[fxruby-users] Custom FXTableItem

Rovshan Baghirov rovshanb at gmail.com
Sat Sep 6 00:58:26 EDT 2008


Hi,

I recently started a new project in order to learn FXRuby and to create
something useful at the same time :) . It uses FXTable widget to display
tables from database and other lists.
I implemented a ComboxBoxTableItem class in order to display lists and
TextFieldTableItem to make it possible select part of cell contents while
keeping it read-only.

Now when I start typing something in custom table item and then press Tab
key without first pressing Enter in order to accept changes, application
crashes with Segmentation Fault error.
I've attached two screenshots and the code is below:

class ComboBoxTableItem < FXTableItem

   def initialize(text, tnsnames)
      super(text)
      @tnsnames=tnsnames
   end

   def getControlFor(table)
      drp=FXComboBox.new(table, 10, :opts=>LAYOUT_FILL)
      drp.numVisible=10
      drp.text=self.text
      @tnsnames.each{ |item| drp.appendItem(item.to_s.upcase) }
      drp.currentItem=drp.findItem(self.text.upcase)
      drp.create
      drp
   end

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

Putting begin rescue around method bodies did not help.

Could you please, help me to find the problem and fix it?

Thanks in advance,
Rovshan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20080906/1d3a1b34/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oexp1.jpg
Type: image/jpeg
Size: 97826 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20080906/1d3a1b34/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oexp2.jpg
Type: image/jpeg
Size: 110639 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20080906/1d3a1b34/attachment-0003.jpg>


More information about the fxruby-users mailing list