[fxruby-users] Custom FXTableItem

Rovshan Baghirov rovshanb at gmail.com
Mon Sep 8 08:03:25 EDT 2008


Hi,

I recently started a new project in order to learn FXRuby. 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 (they were not allowed by moderation system,
so I'm reposting without attachments) 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

My usage: setItem(r, 2, ComboBoxTableItem.new(tns, @tnsnames))

Putting begin rescue around method bodies did not help.

Could you please, help me to find the problem and fix it?
Do I need to implement other methods as well?

Thanks in advance,
Rovshan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20080908/abebb3b5/attachment.html>


More information about the fxruby-users mailing list