[vtk-developers] vtkWidgetEventTranslator -- care and feeding?

Karthik Krishnan karthik.krishnan at kitware.com
Wed Dec 19 11:09:51 EST 2007


Kent:

Thanks. The patch has been committed.

/cvsroot/VTK/VTK/Widgets/vtkContourWidget.cxx,v  <--  vtkContourWidget.cxx
new revision: 1.21; previous revision: 1.20
/cvsroot/VTK/VTK/Widgets/vtkSeedWidget.cxx,v  <--  vtkSeedWidget.cxx
new revision: 1.11; previous revision: 1.10

'xev' on unix yields 127 too.
    state 0x0, (keysym 0xffff, Delete), same_screen YES,
    XLookupString gives 1 bytes: (7f)

7f = 127.

I'm not sure why "47" was used instead. Maybe they were looking at the
VirtualKeyCodeToKeySymTable instead of the ASCIIKeyCodeToKeySym table in
Win32RenderWindowInteractor.

Thanks
--
karthik


On 12/18/07, kent williams <nkwmailinglists at gmail.com> wrote:
>
> OK, here's what I think needs to happen, patch to follow.
>
> The keycode for delete is the ASCII code for the DEL symbol, 127.  And
> if you set a callback for both vtkCommand::KeyPressEvent and
> vtkCommand::CharEvent, the callback gets called twice.
>
> With this change, pressing the 'delete' key works as the
> vtkContourWidget Doxygen man page describes. Setting a decimal Keycode
> of 47 would seem to specify a forward slash rather than the delete
> key.
>
> cvs diff: Diffing .
> Index: vtkContourWidget.cxx
> ===================================================================
> RCS file: /cvsroot/VTK/VTK/Widgets/vtkContourWidget.cxx,v
> retrieving revision 1.20
> diff -c -r1.20 vtkContourWidget.cxx
> *** vtkContourWidget.cxx        18 Dec 2007 16:07:02 -0000      1.20
> --- vtkContourWidget.cxx        18 Dec 2007 22:16:22 -0000
> ***************
> *** 52,64 ****
>                                             vtkWidgetEvent::EndSelect,
>                                             this,
> vtkContourWidget::EndSelectAction);
>     this->CallbackMapper->SetCallbackMethod(vtkCommand::KeyPressEvent,
> !                                           vtkEvent::NoModifier, 47,
> 1, "Delete",
> !                                           vtkWidgetEvent::Delete,
> !                                           this,
> vtkContourWidget::DeleteAction);
> !   this->CallbackMapper->SetCallbackMethod(vtkCommand::CharEvent,
> !                                           vtkEvent::NoModifier, 47,
> 1, "Delete",
>                                             vtkWidgetEvent::Delete,
>                                             this,
> vtkContourWidget::DeleteAction);
>
>     this->CreateDefaultRepresentation();
>
> --- 52,64 ----
>                                             vtkWidgetEvent::EndSelect,
>                                             this,
> vtkContourWidget::EndSelectAction);
>     this->CallbackMapper->SetCallbackMethod(vtkCommand::KeyPressEvent,
> !                                           vtkEvent::NoModifier, 127,
> 1, "Delete",
>                                             vtkWidgetEvent::Delete,
>                                             this,
> vtkContourWidget::DeleteAction);
> + //   this->CallbackMapper->SetCallbackMethod(vtkCommand::CharEvent,
> + //                                           vtkEvent::NoModifier,
> 127, 1, "Delete",
> + //                                           vtkWidgetEvent::Delete,
> + //                                           this,
> vtkContourWidget::DeleteAction);
>
>     this->CreateDefaultRepresentation();
>
>
>
> On Dec 18, 2007 3:26 PM, kent williams <nkwmailinglists at gmail.com> wrote:
> > What I notice now is that there is no key combination that invokes the
> > Delete event handler for the Contour widget.
> >
> >
> > On Dec 18, 2007 10:08 AM, Karthik Krishnan <karthik.krishnan at kitware.com>
> wrote:
> > >
> > >
> > >
> > > On 12/17/07, kent williams <nkwmailinglists at gmail.com> wrote:
> > > > Also, the Delete Point binding is really strange.  In the CVS
> version
> > > > of the widget, hitting 'Ctrl', 'Shift', and on Mac, the CloverLeaf
> Key
> > > > deletes the last point during contour definition, and the currently
> > > > selected point after a contour is closed.  This appears to be a bug,
> > > > since the Doxygen documentation says that the 'Delete' key is bound
> to
> > > > this action.
> > >
> > > This is fixed. Please update the repository and you shouldn't notice
> these
> > > issues.
> > >
> > > Thanks
> > > --
> > > k
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20071219/bed3a26f/attachment.html>


More information about the vtk-developers mailing list