[fxruby-users] FXTextField, FXTable, cut-copy-paste problems

Philippe Lang philippe.lang at attiksystem.ch
Mon Jan 19 02:56:07 EST 2009


Hi,

There are a few cut-copy-paste problems under FXRuby. I took the time
this morning to test everything carefully. Here is the test code I have
been using:

---------------------------
#!/usr/bin/ruby

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)
        
    # Table and textfield
    f = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
    tf = FXTextField.new(f, 16)
    t = FXTable.new(f, nil, 0,
TABLE_COL_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y)
    
    t.visibleRows = 3
    t.visibleColumns = 3
    t.setTableSize(3, 3)
    
    # Data
    tf.text = "123"
    t.setItemText(1, 1, "456")
  end

  def create
    super
    show(PLACEMENT_SCREEN)
  end
  
end

if __FILE__ == $0
  application = FXApp.new("Attik System", "FXRuby Test")
  MyWindow.new(application)
  application.create
  application.run
end
---------------------------

As we can expect, cut or copy behave exactly the same, so I'm just
taking into account the copy-paste commands between the FXTextField and
the FXTable. There are differences when you issue a command on an
FXTable selected cell (after a single clic on a cell, I'll call that the
"select mode"), or on an FXTable cell in "edit mode" (with the cursor
blinking in it).

Here are the results:
---------------------

1. Copy-paste from FXTextField to FXTextField 
-> Everything is fine

2. Copy-paste from FXTextField to FXTable
-> Everything is fine

3. Copy-paste from FXTable to FXTextField
-> Copy in select mode: trailing characters are added at the end of the
pasted text
-> Copy in edit mode: nothing is pasted

4. Copy-paste from FXTable to FXTable
-> Copy in edit mode, paste in select mode: nothing is pasted
-> Copy in edit mode, paste in edit mode: nothing is pasted
-> Copy in select mode, paste in select mode: everything is fine
-> Copy in select mode, paste in edit mode: trailing characters are
added at the end of the pasted text

My setups:
----------

Windows XP, Ruby 1.8.6, FXRuby 1.6.18
MacOS X, Ruby 1.8.6, FXRuby 1.6.18


Is that a fox or fxruby problem?


Philippe






More information about the fxruby-users mailing list