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

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

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
1039 Views, 7 Replies

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

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 !
7 REPLIES 7
Message 2 of 8
cadMeUp
in reply to: Anonymous

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.
Message 3 of 8
Anonymous
in reply to: Anonymous

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
Message 4 of 8
cadMeUp
in reply to: Anonymous

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.
Message 5 of 8
stevenh0616
in reply to: Anonymous

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

Message 6 of 8

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

Message 7 of 8

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

Message 8 of 8

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

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report