I created a paletteSet with 1 palette that contains a .NET tree control. This tree control is populated with values from a database that are associated with AutoCAD blocks. When the user double-clicks an item from the tree, my .NET code prompts the user to select the point on the drawing to insert the block.
Q1) When my .NET code prompts to have the user click on the insertion point, the following code is used.Unfortunately, the user cannot pan and zoom (or use any transparent commands). How can I enable my code to allow for transparent commands?
Dim blockRefPointOptions As PromptPointOptions = New PromptPointOptions("Pick insertion point of Block : " & vbCr)
Dim blockRefPointResult As PromptPointResult = ed.GetPoint(blockRefPointOptions)
If (blockRefPointResult.Status <> PromptStatus.OK) Then
Return
End If
Q2) When the user double-clicks on the palette, the focus of the application is on the palette. This means the user must first click on the drawing to return focus to it and then click again to pick the point of insertion. How can I tell AutoCAD to return the focus to the Active Drawing?
Thanks for your help!
Dan
Solved! Go to Solution.
Solved by caddzone. Go to Solution.
Place all of the code that runs when you double click the item in the control
in a seperate method and apply the CommandMethod attribute to it. Make sure
the method is static. Then, from the double click handler, execute the command
method using SendStringToExecute(), and let the command handler take care
of the rest.
That should also solve the focus problem too.
Thanks for the help caddzone. I will give it a try and let everyone know how it goes.
Thanks
Dan
Thanks again for your help Tony. Moving the code to a new CommandMethod and then calling that method using SendStringToExecute() has almost solved the 2 issues described earlier. I can now pan/zoom after selecting an item from the .NET tree. Unfortunately, after selecting something from the .NET tree, the focus still remains on the palette with the .NET tree instead of turning back to the active document. There is still a cursor visible on the active document, but my mouse pointer is still hovering over the palette (gives the illusion there are 2 mouse pointers). If I right-click on the drawing, the focus will return back to the active document and the second (wrong) mouse pointer will go away. Any thoughts on how to get the focus back to the active document so I don't have to right click on the drawing? I have attached my code, in case you want to review it. There is probably some extraneous code in there, as I've been trying every possible approach (including adding event handlers for the getPoint() method).
Thanks
Dan
Try calling this:
Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView()
just before you call GetPoint()
That worked! Great call Tony! I looked everywhere for that function and couldn't find it. Thank you for your support!