Re: [wxVTK] picking problem: need SetFocus in OnMouseDown?
Brought to you by:
malat
|
From: Mathieu M. <mat...@gm...> - 2007-05-25 08:44:15
|
Hi Tim,
Welcome to wxVTK ! Glad to see yet another VTK ol'timer on the list :)
Your issue would make -sort of- sense if it was on the Mac. It would
at least be consistent with comments from contrib, see
src/stc/PlatWX.cpp (*).
If you have time, could you check what happen if you implement
OnFocus/EVT_SET_FOCUS for wxVTK with something like cout << "OnFocus
called"
Thanks
-Mathieu
(*)
void OnFocus(wxFocusEvent& event) {
GetParent()->SetFocus();
event.Skip();
}
void OnKillFocus(wxFocusEvent& WXUNUSED(event)) {
// Do nothing. Prevents base class from resetting the colors...
}
#ifdef __WXMAC__
// For some reason I don't understand yet the focus doesn't really leave
// the listbox like it should, so if we get any events feed them back to
// the wxSTC
void OnKeyDown(wxKeyEvent& event) {
GetGrandParent()->GetEventHandler()->ProcessEvent(event);
}
void OnChar(wxKeyEvent& event) {
GetGrandParent()->GetEventHandler()->ProcessEvent(event);
}
// And we need to force the focus back when being destroyed
~wxSTCListBox() {
GetGrandParent()->SetFocus();
}
#endif
On 5/25/07, Sander Niemeijer <nie...@st...> wrote:
> Hi Tim,
>
> Which platform are you using?
>
> I know I had to do this explicit SetFocus in
> wxVTKRenderWindowInteractor::OnButtonDown for the Mac Carbon build,
> but as far as I remember it was not necessary for e.g. Linux/GTK.
>
> P.S. The latest version of wxVTK does not have a OnMouseDown, so I
> assume you are actually referring to OnButtonDown.
>
> Best regards,
> Sander Niemeijer
>
>
> On 24-mei-2007, at 13:49, Tim Hutton wrote:
>
> > Hello,
> >
> > When picking in my wxVTK window I sometimes get incorrect results.
> > This happens when I have a toolbar in the same frame window, and one
> > of the toolbar controls has focus. The picked location seems to be
> > vertically offset by the height of the toolbar.
> >
> > I have found that adding a call to SetFocus() near the top of
> > wxVTKRenderWindowInteractor::OnMouseDown() resolves the issue nicely.
> > It makes sense that the render window should get focus when clicked
> > on, I would suggest.
> >
> > Thanks,
> >
> > Tim
> >
> > ----------------------------------------------------------------------
> > ---
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Wxvtk-users mailing list
> > Wxv...@li...
> > https://lists.sourceforge.net/lists/listinfo/wxvtk-users
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wxvtk-users mailing list
> Wxv...@li...
> https://lists.sourceforge.net/lists/listinfo/wxvtk-users
>
--
Mathieu
|