never mind, looks like I fixed it :-)
Problem was that I needed to place all my controls in a panel. For some reason,
panel.evt_navigation_key works but dialog.evt_navigation_key does not. This also
fixed all the weird behavior I mentioned below too.
I am curious though... what is the difference between handling navigation events
coming from a panel and handling the same type of events coming from a dialog?
Thanks,
Walter
________________________________
From: Walter Barnes <walter_barnes05 at yahoo.com>
To: wxRuby Users <wxruby-users at rubyforge.org>
Sent: Fri, September 17, 2010 2:46:35 PM
Subject: [wxruby-users] need help with navigation key events
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/wxruby-users/attachments/20100917/79e693b2/attachment.html>