.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Allowing Pan/Zoom when using PromptPointOptions

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
tifmsolutions
1043 Views, 5 Replies

Allowing Pan/Zoom when using PromptPointOptions

 

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?

 

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

5 REPLIES 5
Message 2 of 6
caddzone
in reply to: tifmsolutions

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.

 



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Message 3 of 6
tifmsolutions
in reply to: caddzone

Thanks for the help caddzone.  I will give it a try and let everyone know how it goes.

 

Thanks
Dan

Message 4 of 6
tifmsolutions
in reply to: caddzone

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

Message 5 of 6
caddzone
in reply to: tifmsolutions

Try calling this:

 

     Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView()

 

just before you call GetPoint()



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Message 6 of 6
tifmsolutions
in reply to: caddzone

That worked!  Great call Tony!  I looked everywhere for that function and couldn't find it.  Thank you for your support!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost