Author Topic: StatusBar context menu?  (Read 2576 times)

0 Members and 1 Guest are viewing this topic.

Chumplybum

  • Newt
  • Posts: 97
StatusBar context menu?
« on: March 11, 2009, 02:27:01 AM »
Hi all

for the life of me i can't get an Autodesk.AutoCAD.Windows.Menu to 'popup' from a pane (or trayitem).
Currently i have a pane button that acts similar to any of the pane buttons (ortho, osnap etc) and on a right click i'm trying to get a menu to 'popup'... previously i've used a system.windows.form.contextmenustrip which has worked fine with '.show'... although i can use this, i would prefer to have the look and feel similar to AutoCAD (the contextmenustrip has larger menu items and larger margins for the checked and bitmap properties)

i've search far and wide for a MyMenu.Show (MyMenu inherits an Autodesk.AutoCAD.Windows.Menu object), or ...Application.StatusBar.ShowMenu, but so far have had no luck

is it possible to show an 'AutoCAD Menu' from a statusbar item???


any help would be great

Cheers, Mark

TonyT

  • Guest
Re: StatusBar context menu?
« Reply #1 on: March 11, 2009, 05:12:09 PM »
Have you tried StatusBarItem.DisplayContextMenu() ?

Hi all

for the life of me i can't get an Autodesk.AutoCAD.Windows.Menu to 'popup' from a pane (or trayitem).
Currently i have a pane button that acts similar to any of the pane buttons (ortho, osnap etc) and on a right click i'm trying to get a menu to 'popup'... previously i've used a system.windows.form.contextmenustrip which has worked fine with '.show'... although i can use this, i would prefer to have the look and feel similar to AutoCAD (the contextmenustrip has larger menu items and larger margins for the checked and bitmap properties)

i've search far and wide for a MyMenu.Show (MyMenu inherits an Autodesk.AutoCAD.Windows.Menu object), or ...Application.StatusBar.ShowMenu, but so far have had no luck

is it possible to show an 'AutoCAD Menu' from a statusbar item???


any help would be great

Cheers, Mark

Chumplybum

  • Newt
  • Posts: 97
Re: StatusBar context menu?
« Reply #2 on: March 11, 2009, 07:14:36 PM »
thanks Tony, i hadn't tried 'DisplayContextMenu' and was a little worried that i may have over looked it. I couldn't find 'DisplayContextMenu' in the objectbrowser, but then i checked a later version of acmgd.dll (i'm using A2008) and found it there.

I've been looking through acad.exe using dependacy walker and found ?DisplayPopupPaneMenu@AcPane@@UAEIAAVCMenu@@@Z and also ?DisplayContextMenu@AcStatusBarItem@@UAEIAAVCMenu@@VCPoint@@@Z.

as my c++ is limited to almost no experience, i'm now having trouble using the right arguments for the pinvoke. i've used a c++ to vb converter to get the following:
Code: [Select]

    <DllImport("acad.exe", CallingConvention:=CallingConvention.Cdecl, EntryPoint:="?DisplayContextMenu@AcStatusBarItem@@UAEIAAVCMenu@@VCPoint@@@Z")> _
    Public Shared Function DisplayContextMenu(ByRef menu As CMenu, ByVal point As CPoint) As UInteger
    End Function


and have replaced 'CMenu' with Autodesk.AutoCAD.Windows.Menu and 'CPoint' with System.Drawing.Point to get the following:
Code: [Select]

    <DllImport("acad.exe", CallingConvention:=CallingConvention.Cdecl, EntryPoint:="?DisplayContextMenu@AcStatusBarItem@@UAEIAAVCMenu@@VCPoint@@@Z")> _
    Public Shared Function DisplayContextMenu(ByRef menu As Autodesk.AutoCAD.Windows.Menu, ByVal point As System.Drawing.Point) As UInteger
    End Function


which (not surprisingly) crashed AutoCAD nicely. Obviously these are wrong... can anyone point me in the right direction???


thanks in advance


Cheers, Mark

TonyT

  • Guest
Re: StatusBar context menu?
« Reply #3 on: March 13, 2009, 05:49:11 AM »
You can't P/Invoke those functions because they take a pointer to
an MFC CMenu as an argument, which you don't have.

thanks Tony, i hadn't tried 'DisplayContextMenu' and was a little worried that i may have over looked it. I couldn't find 'DisplayContextMenu' in the objectbrowser, but then i checked a later version of acmgd.dll (i'm using A2008) and found it there.

I've been looking through acad.exe using dependacy walker and found ?DisplayPopupPaneMenu@AcPane@@UAEIAAVCMenu@@@Z and also ?DisplayContextMenu@AcStatusBarItem@@UAEIAAVCMenu@@VCPoint@@@Z.

as my c++ is limited to almost no experience, i'm now having trouble using the right arguments for the pinvoke. i've used a c++ to vb converter to get the following:
Code: [Select]

    <DllImport("acad.exe", CallingConvention:=CallingConvention.Cdecl, EntryPoint:="?DisplayContextMenu@AcStatusBarItem@@UAEIAAVCMenu@@VCPoint@@@Z")> _
    Public Shared Function DisplayContextMenu(ByRef menu As CMenu, ByVal point As CPoint) As UInteger
    End Function


and have replaced 'CMenu' with Autodesk.AutoCAD.Windows.Menu and 'CPoint' with System.Drawing.Point to get the following:
Code: [Select]

    <DllImport("acad.exe", CallingConvention:=CallingConvention.Cdecl, EntryPoint:="?DisplayContextMenu@AcStatusBarItem@@UAEIAAVCMenu@@VCPoint@@@Z")> _
    Public Shared Function DisplayContextMenu(ByRef menu As Autodesk.AutoCAD.Windows.Menu, ByVal point As System.Drawing.Point) As UInteger
    End Function


which (not surprisingly) crashed AutoCAD nicely. Obviously these are wrong... can anyone point me in the right direction???


thanks in advance


Cheers, Mark

Chumplybum

  • Newt
  • Posts: 97
Re: StatusBar context menu?
« Reply #4 on: March 15, 2009, 07:05:41 PM »
thanks Tony