.NET

Reply
*Vassil
Message 1 of 8 (324 Views)

How to respond to a click on Autodesk.AutoCAD.Windows.Pane ?

324 Views, 7 Replies
10-11-2007 06:48 AM
Hello !
I'm new to vb.net (moving from VBA) so please excuse me if this sounds
stupid... I'm adding a pane to the status bar an I want to show a popup menu
(or execute a command) after clicking on the pane. This is my code :

Dim DetPane As New Autodesk.AutoCAD.Windows.Pane

DetPane.Text = "DE : "

DetPane.MinimumWidth = 30

DetPane.ToolTipText = "Current Detail : "

DetPane.Enabled = True

DetPane.Visible = True

DetPane.Style = Autodesk.AutoCAD.Windows.PaneStyles.PopUp

Application.StatusBar.Panes.Add(DetPane)

Please, let me know how to create the callback function. Thanks in advance !
Valued Mentor
cadMeUp
Posts: 331
Registered: ‎05-11-2006
Message 2 of 8 (325 Views)

Re: How to respond to a click on Autodesk.AutoCAD.Windows.Pane ?

10-11-2007 01:07 PM in reply to: *Vassil
I am not sure how to hook events in VB, I use mostly use C# for customizing AutoCAD 2008. Looking in the VS object browser a 'Pane' object is derived from 'StatusBarItem' which has a 'MouseDown' event that you can hook into.

The event handler would have this similar signature:

Autodesk.AutoCAD.Windows.StatusBarMouseDownEventHandler.StatusBarMouseDownEventHandler(void (object, Autodesk.AutoCAD.Windows.StatusBarMouseDownEventArgs))

I have very limited experience with VB NET so I can't show you how you would wire it up.
*Vassil
Message 3 of 8 (323 Views)

WOW ! I'm happy !

10-12-2007 02:23 AM in reply to: *Vassil
Thanks alot !

This is the code and it is working :smileyhappy: :

................

AddHandler DetPane.MouseDown, AddressOf OnPaneMouseDown

.................

Sub OnPaneMouseDown(ByVal o As Object, ByVal e As
StatusBarMouseDownEventArgs)

Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(vbNewLine
+ "Do something man !" + vbNewLine)

End Sub
Valued Mentor
cadMeUp
Posts: 331
Registered: ‎05-11-2006
Message 4 of 8 (324 Views)

Re: WOW ! I'm happy !

10-12-2007 06:37 AM in reply to: *Vassil
That's great to hear! I am going to keep your sample for my possible future use! It gives me a good example of how to hook an event in VB.
Contributor
stevenh0616
Posts: 22
Registered: ‎04-12-2011
Message 5 of 8 (203 Views)

Re: WOW ! I'm happy !

12-20-2012 08:12 AM in reply to: *Vassil

Anyone figure out how to make this work in 2013? Pane.MouseDown does not seem to exist? Please help!!

Steve

Windows 7 Enterprise 64-bit SP1
Intel Core i7 CPU X920 @ 1.73 GHz
16.00 GB RAM
Civil 3D 2013 - 2015

Check out my AutoCAD, Civil 3D, and Map Apps on the Autodesk Exchange Store at: Autodesk Exchange Store
Moderator
Alexander.Rivilis
Posts: 1,412
Registered: ‎04-09-2008
Message 6 of 8 (198 Views)

Re: WOW ! I'm happy !

12-20-2012 08:33 AM in reply to: stevenh0616

Are you sure?

20-12-2012 18-31-51.png


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Contributor
stevenh0616
Posts: 22
Registered: ‎04-12-2011
Message 7 of 8 (190 Views)

Re: WOW ! I'm happy !

12-20-2012 09:49 AM in reply to: Alexander.Rivilis

Well I see that it's there under StatusBarItem, but it gives an error under Pane....

 

If I Have code like this

 

Dim DetPane As New Autodesk.AutoCAD.Windows.Pane
DetPane.Text = "DE : "
DetPane.MinimumWidth = 30
DetPane.ToolTipText = "Current Detail : "
DetPane.Enabled = True
DetPane.Visible = True
DetPane.Style = Autodesk.AutoCAD.Windows.PaneStyles.PopUp
DetPane.MouseDown += New StatusBarMouseDownEventHandler(AddressOf OnAppMouseDown)
Application.StatusBar.Panes.Add(DetPane)

 

I get this... Could I be missing an Import??

API.png

 

Here are my imports...

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports cadApp = Autodesk.AutoCAD.ApplicationServices.Application
Imports cadDocExt = Autodesk.AutoCAD.ApplicationServices.DocumentExtension
Imports Autodesk.AutoCAD.Windows

 

Steve

Windows 7 Enterprise 64-bit SP1
Intel Core i7 CPU X920 @ 1.73 GHz
16.00 GB RAM
Civil 3D 2013 - 2015

Check out my AutoCAD, Civil 3D, and Map Apps on the Autodesk Exchange Store at: Autodesk Exchange Store
Moderator
Alexander.Rivilis
Posts: 1,412
Registered: ‎04-09-2008
Message 8 of 8 (186 Views)

Re: WOW ! I'm happy !

12-20-2012 11:26 AM in reply to: stevenh0616
Sub OnPaneMouseDown(ByVal o As Object, ByVal e As StatusBarMouseDownEventArgs)
    Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(vbNewLine + "Do something man !" + vbNewLine)
End Sub
<CommandMethod("MyCommand")> _
Public Sub MyCommand() ' This method can have any name
    Dim DetPane As New Autodesk.AutoCAD.Windows.Pane
    DetPane.Text = "DE : "
    DetPane.MinimumWidth = 30
    DetPane.ToolTipText = "Current Detail : "
    DetPane.Enabled = True
    DetPane.Visible = True
    DetPane.Style = Autodesk.AutoCAD.Windows.PaneStyles.PopUp
    AddHandler DetPane.MouseDown, AddressOf OnPaneMouseDown
    Application.StatusBar.Panes.Add(DetPane)
End Sub

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.