Hand down events from textctrl to listctrl

Hello,

I'd like to hand down some events to textctrl.

The focus should stay in the textctrl, unless
it is changed by mouse or tab key.

···

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

textctrl |

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

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

listctrl |
item1 |
item2 |
item3 |
                     >
                     >

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

Normal typing in text ctrl.
But if I type curor-down cursor up (and curor-down cursor up)
the events should be sent to listctrl, which should
process them as it has the focus.

The focus should remain in the textctrl.

How is it possible to send the event to listctrl?

(I tried catch EVT_CHAR from textctrl and submit them to listctrl

like):
         if kcode == 317 or kcode == 319: #cursor down/up Keys
            self.parent.results.SetFocus() # the listctrl
            self.parent.results.GetEventHandler().ProcessEvent(event)
            self.SetFocus()

but this did not work.

Many thanks in advance!
--
Franz Steinhäusler

DrPython (Project Developer)
http://drpython.sourceforge.net/

Franz Steinhäusler wrote:

Hello,

I'd like to hand down some events to textctrl.

The focus should stay in the textctrl, unless
it is changed by mouse or tab key.

------------------------
> textctrl | ------------------------

------------------------
> listctrl | > item1 | > item2 | > item3 | > > > > ------------------------

Normal typing in text ctrl.
But if I type curor-down cursor up (and curor-down cursor up)
the events should be sent to listctrl, which should
process them as it has the focus.

When you send wx events to another window they are *not* translated to native messages and sent at that level, so they can't invoke any native behaviour in the control. They will only be delivered to event handlers bound in the wx way.

The only thing you can do is to do yourself what those keys would have done if they had originated from the control, so you'll need to move the selection and ensure it is visible by calling methods of the listctrl.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hello Robin,

thank you for your reply,

I see, the problem is, there is no way to invoke the native behaviour in
the target control.
I succeeded with cursor up down key already, but i would like
to imitate the page-up page-down keys.
I have to find a way of getting the amount of the visible displayed
items and then jump accordingly.

Cheers,

···

On Thu, 23 Sep 2004 19:26:47 -0700, Robin Dunn <robin@alldunn.com> wrote:

Franz Steinhäusler wrote:

Hello,

I'd like to hand down some events to textctrl.

The focus should stay in the textctrl, unless
it is changed by mouse or tab key.

------------------------
> textctrl |
------------------------

------------------------
> listctrl |
> item1 |
> item2 |
> item3 |
> >
> >
------------------------

Normal typing in text ctrl.
But if I type curor-down cursor up (and curor-down cursor up)
the events should be sent to listctrl, which should
process them as it has the focus.

When you send wx events to another window they are *not* translated to
native messages and sent at that level, so they can't invoke any native
behaviour in the control.

They will only be delivered to event handlers
bound in the wx way.

The only thing you can do is to do yourself what those keys would have
done if they had originated from the control, so you'll need to move the
selection and ensure it is visible by calling methods of the listctrl.

--
Franz Steinhäusler

DrPython (Project Developer)
http://drpython.sourceforge.net/