Author Topic: Windows cursor issue  (Read 2087 times)

0 Members and 1 Guest are viewing this topic.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Windows cursor issue
« on: April 23, 2016, 11:58:45 AM »
I have a context menu which has an item which calls a method which has a call to ed.GetSelection(). Everything works fine, except the cursor remains as the windows cursor instead of switching to the pickbox, thus making it difficult to select the object. I've added a call to Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView(); which did not help. Here is a quick screencast showing the issue: http://autode.sk/1XOs9GE

Any ideas on how to force the cursor to switch to the selection pickbox automatically? As soon as the user misses the pick it goes to the normal window/crossing selection and the cursor is fine after that. But I'd sure like for it to be correct from the start.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Windows cursor issue
« Reply #1 on: April 24, 2016, 04:56:06 AM »
Hi,

Did you try to wrap the called method in a CommandMethod and call it with SenStringToExecute ?
Speaking English as a French Frog

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Windows cursor issue
« Reply #2 on: April 24, 2016, 11:44:51 AM »
Hi gile, no, I hadn't tried that so just did and get the same result. It does have the benefit of the user being able to hit Enter or space bar to repeat the command so I will leave like this. Thanks!

huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Re: Windows cursor issue
« Reply #3 on: April 24, 2016, 01:55:56 PM »
Do you have a small example? I have a context menu somehwere without any mouse cursor trouble, so I could compare it.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Windows cursor issue
« Reply #4 on: April 24, 2016, 02:27:06 PM »
I'll try to get a small example later. Although I just was doing some testing in C3D2017 and the cursor changes as expected. So decided to check C3D2015, it works fine there, too. So may be just a 2016 issue, or even specific to SP2? Based on this, I don't think I will worry about it since it doesn't appear to be my code causing it.

Thanks for looking, guys!.

Chumplybum

  • Newt
  • Posts: 97
Re: Windows cursor issue
« Reply #5 on: April 25, 2016, 07:10:57 PM »
try Editor.StartUserInteraction, i've never used it myself but there was a blog post a few years ago on it... http://adndevblog.typepad.com/autocad/2012/05/taking-mouse-inputs-from-a-modal-dialog-box.html

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Windows cursor issue
« Reply #6 on: April 25, 2016, 07:39:58 PM »
Thank you for that suggestion, it sounded promising. However, it needs a modal form passed as the argument so I don't think it will work with contextmenus. I did try to get it to work, but no amount of trickery would allow it to recognize the menu as a form.

Chumplybum

  • Newt
  • Posts: 97
Re: Windows cursor issue
« Reply #7 on: April 25, 2016, 07:53:09 PM »
another option is to set focus to autocad on the mouse click...  I've used the code below when entering values into a ribbon textbox, but could be modified for the mouse click event.

Code: [Select]
    <System.Runtime.InteropServices.DllImport("user32.dll")>
    Private Shared Function SetFocus(ByVal hwnd As IntPtr) As IntPtr
    End Function


    Private Sub callback_PropertyChanged(sender As Object, e As System.ComponentModel.PropertyChangedEventArgs)
        SetFocus(Autodesk.AutoCAD.ApplicationServices.Application.MainWindow.Handle)
    End Sub

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Windows cursor issue
« Reply #8 on: April 26, 2016, 07:27:11 AM »
Shot in the dark here, Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();
Revit 2019, AMEP 2019 64bit Win 10

BillZndl

  • Guest
Re: Windows cursor issue
« Reply #9 on: April 26, 2016, 12:56:23 PM »
Shot in the dark here, Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();

Yup,

you beat me to it....

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Windows cursor issue
« Reply #10 on: April 26, 2016, 01:22:17 PM »
Ding! Ding! Ding! We have a winner! That solved the issue in 2016, thank you MC!