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

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

Anonymous
Not applicable
1,496 Views
7 Replies
Message 1 of 8

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

Anonymous
Not applicable
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 !
0 Likes
1,497 Views
7 Replies
Replies (7)
Message 2 of 8

cadMeUp
Collaborator
Collaborator
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.
0 Likes
Message 3 of 8

Anonymous
Not applicable
Thanks alot !

This is the code and it is working 🙂 :

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

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
0 Likes
Message 4 of 8

cadMeUp
Collaborator
Collaborator
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.
0 Likes
Message 5 of 8

stevenh0616
Collaborator
Collaborator

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

Steve Hill, Civil Designer / .NET Developer / AutoCAD and AutoCAD Civil 3D Certified Professional
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

http://redtransitconsultants.com/
Autodesk Exchange Store
Twitter | LinkedIn | YouTube

0 Likes
Message 6 of 8

Alexander.Rivilis
Mentor
Mentor

Are you sure?

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

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 7 of 8

stevenh0616
Collaborator
Collaborator

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 Hill, Civil Designer / .NET Developer / AutoCAD and AutoCAD Civil 3D Certified Professional
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

http://redtransitconsultants.com/
Autodesk Exchange Store
Twitter | LinkedIn | YouTube

0 Likes
Message 8 of 8

Alexander.Rivilis
Mentor
Mentor
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

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes