[fxruby-users] Selections strange behaviour

Philippe Lang philippe.lang at attiksystem.ch
Fri May 11 04:55:12 EDT 2007


Hi,
 
I've noticed a strange behaviour with textfield selections, when you
loose the focus of a control. When you click on another control or when
you use the TAB key, the selection is sometimes still visible,
"greyed-out".
 
Apparently, there is a selection "remanence" when you use the mouse to
move from one control to another, all the time.
There is also such a behaviour when you use the TAB key to go to a field
that has no content. If the control you move to has content, selection
disappears.

I'm not sure this is a bug, but I think it is quite strange...

Here is the test code: simply run the program, and press TAB, or click
into textfields 2, 3 or 4.

I'm using ruby186-25.exe under Windows XP, with
fxruby-1.6.11-mswin32.gem.

Philippe Lang

----------------------

#!/usr/bin/ruby

require 'fox16'

include Fox

class MyWindow < FXMainWindow
   
  def initialize(app)

    super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 300, 150)

    # 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)

    # Fields
    f = FXMatrix.new(self, 3,
      MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP)
   
    t1 = FXTextField.new(f, 10, nil, 0,
      FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW)

    t2 = FXTextField.new(f, 10, nil, 0,
      FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW)
     
    t3 = FXTextField.new(f, 10, nil, 0,
      FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW)
     
    t4 = FXTextField.new(f, 10, nil, 0,
      FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW)
     
        # Values
        t1.text = "123"
        t2.text = "456"
       
        # Selection
        t1.setFocus
        t1.selectAll
   
  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 




More information about the fxruby-users mailing list