[fxruby-users] Copy-paste between FXTable and FXTextfield

Philippe Lang philippe.lang at attiksystem.ch
Mon Apr 14 04:05:11 EDT 2008


I'm using FXRuby 1.6.13 under Windows XP / Ruby 1.8.6.

I've noticed something strange when copying-pasting things between
FXTable cells, and FXTextfields.


1) When copying the content of an FXTextfield, and pasting it into an
FXTable cell, everything works fine.

2) When selecting an FXTable cell, issuing a "copy" with the keyboard,
and pasting into the text field, the result is more or less correct,
except that two unknown characters are added at the end of the
textfield. The same problem happens when pasting into notepad.

3) When selecting an FXTable cell CONTENT (not the cell itself), issuing
a "copy" with the keyboard, and pasting into the text field, nothing
happens. The same problem happens when pasting into notepad.


I think there is a good chance the "copy" command has got a bug with the
object FXTable. Is that correct?

Here is my test code:



require 'rubygems'
require 'fox16'

include Fox

class MyWindow < FXMainWindow
  def initialize(app)

    super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 600, 350)

    # Menu bar stretched along the top of the main window
    menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
    # File menu
    filemenu = FXMenuPane.new(self)
    FXMenuTitle.new(menubar, "&File", nil, filemenu)
    FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application",
        nil, app, FXApp::ID_QUIT)
    # Field
    field = FXTextField.new(self, 15)

    # Table
    f = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
    table = FXTable.new(f, nil, 0,
    table.visibleRows = 3
    table.visibleColumns = 3
    table.setTableSize(3, 3)
    # Data
    field.text = 'copy me!'
    table.setItemText(0, 0, 'copy me!')

  def create

if __FILE__ == $0
  application = FXApp.new("Attik System", "FXRuby Test")



Philippe Lang

More information about the fxruby-users mailing list