[vtkusers] Change mouse cursor while hovering on vtkSphereWidget

Cory Quammen cory.quammen at kitware.com
Mon Oct 13 15:48:34 EDT 2014


Alok,

This is the standard way for developers to contribute to VTK:


On Mon, Oct 13, 2014 at 3:12 PM, Alok <alok.theanomaly at gmail.com> wrote:
> Hi,
>
> I sub-classed vtkAbstractWidget and created a vtkSphereWidget3.
>  It seems to be working as expected when I use it in this example :
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/SphereWidget2
>
> I think that 'mouse cursor change on hover' feature is a desirable one since
> it indicates to the user that interaction with a sphere is possible and
> expected.
>
> I would like to know how I can commit this piece of code for review and
> inclusion into the vtk repository.
>
> Thanks
>
>
> On Fri, Oct 10, 2014 at 10:15 AM, Cory Quammen <cory.quammen at kitware.com>
> wrote:
>>
>> Alok,
>>
>> What I usually do is copy and paste an existing class and then modify
>> it appropriately, e.g., renamed the class, change the parent class,
>> remove unneeded member variables, methods, change the comments for the
>> class, etc. In your case, I would copy the vtkSphereWidget2 class to a
>> new class (vtkSphereWidget3?) and copy in the implementation for
>> SetCursor() in vtkHandleWidget, then be sure to declare this method in
>> your classes header file.
>>
>> - Cory
>>
>> On Fri, Oct 10, 2014 at 9:53 AM, Alok <alok.theanomaly at gmail.com> wrote:
>> > Thanks Cory
>> > I dont have experience with subclassing vtk classes yet. Is there any
>> > other
>> > class that you can suggest as a reference to look at while going about
>> > this?
>> >
>> >
>> >
>> > On Thu, Oct 9, 2014 at 5:13 PM, Cory Quammen <cory.quammen at kitware.com>
>> > wrote:
>> >>
>> >> I think you will have to subclass vtkSphereWidget2 and override the
>> >> SetCursor() method. The SetCursor() method for vtkHandleWidget is
>> >>
>> >>
>> >>
>> >> //-------------------------------------------------------------------------
>> >> void vtkHandleWidget::SetCursor(int cState)
>> >> {
>> >>   if ( this->ManagesCursor )
>> >>     {
>> >>     switch (cState)
>> >>       {
>> >>       case vtkHandleRepresentation::Outside:
>> >>         this->RequestCursorShape(VTK_CURSOR_DEFAULT);
>> >>         break;
>> >>       default:
>> >>         this->RequestCursorShape(VTK_CURSOR_HAND);
>> >>       }
>> >>     }
>> >> }
>> >>
>> >> I imagine you would want the same in your subclass.
>> >>
>> >> HTH,
>> >> Cory
>> >>
>> >> On Thu, Oct 9, 2014 at 5:03 PM, junior <alok.theanomaly at gmail.com>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > I want the mouse cursor to change to a 'hand' when the mouse is
>> >> > hovering
>> >> > over a vtkSphereWidget.
>> >> > Is there any out of box solution for this or do I need to subclass? I
>> >> > tried
>> >> > using vtkSphereWidget2 and setting ManagesCursorOn() to true but that
>> >> > did
>> >> > not help.
>> >> >
>> >> > I see that the vtkAngleWidget exhibits the said behavior when mouse
>> >> > hovers
>> >> > above one of the three control points which in my understanding are
>> >> > vtkHandleWidgets.
>> >> >
>> >> > Any suggestions??
>> >> > Thanks
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> >> > http://vtk.1045678.n5.nabble.com/Change-mouse-cursor-while-hovering-on-vtkSphereWidget-tp5729100.html
>> >> > Sent from the VTK - Users mailing list archive at Nabble.com.
>> >> > _______________________________________________
>> >> > Powered by www.kitware.com
>> >> >
>> >> > Visit other Kitware open-source projects at
>> >> > http://www.kitware.com/opensource/opensource.html
>> >> >
>> >> > Please keep messages on-topic and check the VTK FAQ at:
>> >> > http://www.vtk.org/Wiki/VTK_FAQ
>> >> >
>> >> > Follow this link to subscribe/unsubscribe:
>> >> > http://public.kitware.com/mailman/listinfo/vtkusers
>> >
>> >
>> >
>> >
>> > --
>> > I live a simple life...  in 0s and 1s !
>
>
>
>
> --
> I live a simple life...  in 0s and 1s !


More information about the vtkusers mailing list