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
On Friday 11 May 2007 03:55, Philippe Lang wrote:> 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...It is not a bug. The selection of one text field is lost when something else gets selected. You can middle-mouse paste text from the field that has the selection into some other control (FXText or FXTextField). On X11, selection is system-wide, i.e. you can paste from FXTextField in a FOX application to something that acceptes text, possibly in another application. When focus is transferred to a FXTextField, text in the field, if there is any, is selected. The selection of the original FXTextField is lost only as a side effect of the fact that there is only one selection in the system [on Windows, we can only manage the primary selection within the application, but on X11 its system-wide]. Hope this explains, Jeroen
Jeroen van der Zijp wrote:>> 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... > > It is not a bug. > > <snip> > > You can middle-mouse paste text from the field that has the selection > into some other control (FXText or FXTextField).Thanks! I didn''t know about the middle-mouse click that allows to past text. Very useful. Best regards, Philippe Lang