• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    *Vassil

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

    204 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 !
    Please use plain text.
    Valued Mentor
    Posts: 330
    Registered: ‎05-11-2006

    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.
    Please use plain text.
    *Vassil

    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
    Please use plain text.
    Valued Mentor
    Posts: 330
    Registered: ‎05-11-2006

    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.
    Please use plain text.
    Active Member
    stevenh0616
    Posts: 7
    Registered: ‎04-12-2011

    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 SP1 64-bit

    Check out my AutoCAD, Civil 3D, and Map Apps on the Autodesk Exchange Store at: Autodesk Exchange Store or Red Transit Consultants, LLC Website
    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,176
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Active Member
    stevenh0616
    Posts: 7
    Registered: ‎04-12-2011

    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 SP1 64-bit

    Check out my AutoCAD, Civil 3D, and Map Apps on the Autodesk Exchange Store at: Autodesk Exchange Store or Red Transit Consultants, LLC Website
    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,176
    Registered: ‎04-09-2008

    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

    Please use plain text.