Still having the problem...

I've looked at Mario's example and he's added the following to the
onKeyDown Code:

int GraphicsWindowWX::adaptKey(wxKeyEvent &event)
{
#if wxUSE_UNICODE
    int key = event.GetUnicodeKey();
#else
    int key = event.GetKeyCode();
#endif
        bool caps_lock = ::wxGetKeyState(WXK_CAPITAL);

        int em = event.GetModifiers();
    if( ((em & wxMOD_SHIFT) == wxMOD_SHIFT) ^ caps_lock)
    {
                key = toupper(key);
        }
        else
    {
                key = tolower(key);
        }
    if( em & wxMOD_CONTROL)
    {
                key &= 0x1F;
        }

        return key;
}

void GraphicsWindowWX::OnKeyDown(wxKeyEvent &event)
{
        int key = adaptKey(event);
    getEventQueue()->keyPress(key);

    // propagate event
    event.Skip();
}

void GraphicsWindowWX::OnKeyUp(wxKeyEvent &event)
{
        int key = adaptKey(event);
    getEventQueue()->keyRelease(key);

    // propagate event
    event.Skip();
}
 
 The problem I am having is that OnKeyDown and OnKeyUp methods are never
called when I press a key. The mouse handler functions work fine so I
can control the camera with the mouse. They key press events are not
detected within wxWidgets or OSG EventHandlers.

Anyone else have some Ideas???
Thanks- 
Steve




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Powers
Sent: Tuesday, May 13, 2008 10:24 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] wxWidgets onKeyDown Event not called

Yes Please do. I remember reading from the archives that it was sending
'S' rather than 's'. But I think my problem might be different. I cant
get the OnKeyDown Method to be called at all. When I place breakpoints
inside of the function they are never hit.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mario
Valle
Sent: Tuesday, May 13, 2008 10:14 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] wxWidgets onKeyDown Event not called

Yes.
The example included in OSG need a little fix to make the 's'
(statistics) handler work.
If you want I can send you an example.
Ciao!
        mario


Steven Powers wrote:
> Has anyone been able to get the keyboard handlers to work within the
> osgViewerWx example?
>  
>  
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
Steven
> Powers
> Sent: Monday, May 12, 2008 11:53 AM
> To: OpenSceneGraph Users
> Subject: [osg-users] wxWidgets onKeyDown Event not called
> 
> 
> I cant seem to get the onKeyDown/onKeyUp events to get called within
the
> osgViewerWx example. The mouse/resize/draw event handlers work just
> fine.
> 
> I'm using the unchanged source from OSG 2.2 and wxWidgets 2.8.7.
> 
> Thanks in advance,
> 
> Steve
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
> 

-- 
Ing. Mario Valle
Data Analysis and Visualization Services         |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91)
610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91)
610.82.82
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to