Philippe Lang
2008-Apr-14 08:05 UTC
[fxruby-users] Copy-paste between FXTable and FXTextfield
Hi, 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: ---------------------------------------------- #!/usr/bin/ruby 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_COL_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y) table.visibleRows = 3 table.visibleColumns = 3 table.setTableSize(3, 3) # Data field.text = ''copy me!'' table.setItemText(0, 0, ''copy me!'') 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 ---------------------------------------------- Regards, Philippe Lang
Lyle Johnson
2008-Apr-15 03:05 UTC
[fxruby-users] Copy-paste between FXTable and FXTextfield
On Apr 14, 2008, at 3:05 AM, Philippe Lang wrote:> 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.OK.> 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.OK, that can probably be fixed in a patchlevel release of FOX 1.6, if Jeroen thinks it''s worth it.> 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.That one''s a little trickier and probably can''t be fixed in FOX 1.6 (although it would be nice to see it fixed in 1.8). The problem is that the table''s concept of "selection" is a range of cells (i.e. at least one complete table cell). If you''re just selecting some text within a cell, but selecting the cell itself, FOX doesn''t think you have anything selected.> I think there is a good chance the "copy" command has got a bug with > the > object FXTable. Is that correct?Yes, at least for point #2. It would be nice for the scenario described in your point #3 to work as well, though.
Philippe Lang
2008-Apr-15 06:09 UTC
[fxruby-users] Copy-paste between FXTable and FXTextfield
fxruby-users-bounces at rubyforge.org wrote:>> 1) When copying the content of an FXTextfield, and pasting it into an >> FXTable cell, everything works fine. > > OK. > >> 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. > > OK, that can probably be fixed in a patchlevel release of FOX 1.6, if > Jeroen thinks it''s worth it. > >> 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. > > That one''s a little trickier and probably can''t be fixed in FOX 1.6 > (although it would be nice to see it fixed in 1.8). The problem is > that the table''s concept of "selection" is a range of cells (i.e. at > least one complete table cell). If you''re just selecting some text > within a cell, but selecting the cell itself, FOX doesn''t think you > have anything selected. > >> I think there is a good chance the "copy" command has got a bug with >> the object FXTable. Is that correct? > > Yes, at least for point #2. It would be nice for the scenario > described in your point #3 to work as well, though.Hi Lyle, Thanks for your answer. Can you imagine a workaround for the actual version of Fox and FXRuby? Philippe
Lyle Johnson
2008-Apr-18 16:38 UTC
[fxruby-users] Copy-paste between FXTable and FXTextfield
On Apr 15, 2008, at 1:09 AM, Philippe Lang wrote:> Thanks for your answer. Can you imagine a workaround for the actual > version of Fox and FXRuby?Without completely overriding the built-in cut/copy/paste support in FXTable, it would be impossible to work around these problems with the current releases of FOX and FXRuby. I might be able to make a change in FXRuby that would at least make this possible (but still difficult). One of the basic problems is that the variable that FOX uses to store the clipped (i.e. copied or cut) data for the table in stored in a protected member variable (named "clipped") that is not exposed via any of FXTable''s public interfaces. So you can get to it at the moment. I should be able to expose that variable in FXRuby''s wrapper for FXTable, but you''d still have to reimplement/override parts of FXTable''s cut & paste mechanisms, just to patch around the existing bugs that you''ve discovered. So, short answer is that it would be best for Jeroen to fix this directly in FOX. He might be more amenable to doing so if someone provided a patch.