Hello,
I’m having some trouble figuring out how to process navigation key
events. I
added the following test code to my dialog box:
def initialize( … )
evt_navigation_key(:on_navigation_key)
end
def on_navigation_key(event)
puts “–tab pressed–”
puts " event object: " + event.get_event_object.inspect
obj = event.get_current_focus
if obj
puts " current focus: " + obj.inspect
else
puts " event.get_current_focus returned nil"
puts " current focus: " + Wx::Window.find_focus.inspect
end
event.skip
end
When testing the dialog box (which subclasses Wx::Dialog) there are no
messages
when tabbing from a text control. All other controls generate the
expected
messages. I am able however to tab through all controls in the correct
order
both forward and back.
All my controls except for a checkbox are grouped in static boxes. I
have tried
doing “xxxx.evt_navigation_key { |event| on_navigation_key(event) }” for
the
text boxes as well as the static boxes that contain them to no effect.
I’ve also noticed unusual behavior too. When tabbing into a radio box,
there is
no visual indication that it has the focus if the text control that
precedes it
is enabled. If the text control is disabled then it works fine. Also,
when doing
a shift+tab to navigate backwards, it will first go forward one control
then
start going backwards. Lastly, two navigation events with the same
output are
generated when cycling from the last control back to the first.
How do I get the navigation events to work properly and how can I
capture
navigation events when a text control has the focus?
Some additional info: I’m using Windows XP SP3, all controls and static
boxes
are children of the dialog box, all text controls are single line with
the
TE_RICH window style.
TIA,
Walter