John Reed wrote:
I searched the posts for an answer to my question and based on the
information that I found, my code should work. Here is the answer that
I found:Quoting Jeroen’s response from the foxgui-users mailing list:
“The tab order is implied by the widget insertion order. The arrow
keys can
be used to navigate based on geometric placement.”What is happening is that when I hit the tab from the “Female”
(sexgrp) field on my screen, it skips over the “Date of death”
(dodtxt) field and goes to the “Social Security #” (ssntxt) field.
I’ve tried to delete the code and then paste it back, but it always
does the same thing. Here is my code:
I can’t reproduce this here; if I click on the “Female” radio button (to
give it the focus) and then press the tab key, it jumps to the “Date of
death” field as expected.
Can you try the test program I used (shown below) to see if it works
properly on your system? If it does, maybe something else is going on in
your real program that the code snippet doesn’t show.
Lyle
<<< test program follows
require ‘fox’
include Fox
class TabOrderWindow < FXMainWindow
def initialize(anApp)
# Initialize base class
super(anApp, “TabOrder”, nil, nil, DECOR_ALL, 0, 0, 800, 300)
# Contents
contents = FXPacker.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
# Sex
sexgrp = FXGroupBox.new(contents, "2. Sex",
FRAME_GROOVE|LAYOUT_FIX_X|LAYOUT_FIX_Y, x=275, y=10)
sexgrp.setFont(FXFont.new(getApp(), "helvetica", 12))
FXRadioButton.new(sexgrp, "&Male", nil, 0,
ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
FXRadioButton.new(sexgrp, "&Female", nil, 0,
ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
# Date of death
dodlbl1 = FXLabel.new(contents,
"3. &Date of Death ", nil,
LAYOUT_FIX_X|LAYOUT_FIX_Y, x=365, y=10)
dodlbl1.setFont(FXFont.new(getApp(), "helvetica", 12))
dodlbl2 = FXLabel.new(contents,
"(month, day, year)", nil,
LAYOUT_FIX_X|LAYOUT_FIX_Y, x=375, y=30)
dodlbl2.setFont(FXFont.new(getApp(), "helvetica", 10))
dodtxt = FXTextField.new(contents, 15, nil, 0,
JUSTIFY_LEFT|FRAME_SUNKEN|FRAME_THICK|
LAYOUT_FIX_X|LAYOUT_FIX_Y, x=365, y=55)
dodtxt.setFont(FXFont.new(getApp(), "helvetica", 12))
# Social security number
ssnlabel = FXLabel.new(contents,
"4. &Social Security Number", nil,
LAYOUT_FIX_X|LAYOUT_FIX_Y, x=540, y=10)
ssnlabel.setFont(FXFont.new(getApp(), "helvetica", 12))
ssntxt = FXTextField.new(contents, 11, nil, 0,
TEXTFIELD_LIMITED|JUSTIFY_LEFT|FRAME_SUNKEN|FRAME_THICK|
LAYOUT_FIX_X|LAYOUT_FIX_Y, x=560, y=55)
ssntxt.setFont(FXFont.new(getApp(), "helvetica", 12))
end
def create
super
show(PLACEMENT_SCREEN)
end
end
if FILE == $0
FXApp.new(“TabOrder”, “FXRuby”) do |anApp|
TabOrderWindow.new(anApp)
anApp.create
anApp.run
end
end