View Full Version : Adding a drop down window to a toolbar
dsolak
2006-02-20, 08:50 PM
I trying to make a drop down windowappear by clicking a toolbar button instead of using the standard autocad flyouts. I have included a screenshot of program I have that allready does this. I can not find any info on this please help.
RobertB
2006-02-28, 03:34 AM
Mentioning what 3rd-party application might help. There isn't a way to do this via VBA, AFAIK.
ntaylor
2006-02-28, 11:08 PM
A possible way would be to create the dropdown window as a form in VBA. Call the following code from the forms activate event to remove its titlebar.
Option Explicit
Private Declare Function GetActiveWindow Lib "user32.dll" () As Long
Private Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Sub RemoveTitleBar()
Dim hwnd As Long
Dim dwNewLong As Long
hwnd = GetActiveWindow()
dwNewLong = GetWindowLong(hwnd, -16)
dwNewLong = dwNewLong And Not &HC00000
Call SetWindowLong(hwnd, -16, dwNewLong)
DrawMenuBar hwnd
End Sub
In the toolbar run some VBA code that shows the form and sets it position to where the mouse is.
Regards - Nathan
Isn't the example shown just a shortcut menu activated by the button? Wouldn't a macro assigned to a button to display a shortcut menu be easier?
ntaylor
2006-03-01, 12:32 AM
Possibly. How would the shortcut menu be stored ? What would the macro to display the shortcut menu look like ?
Regards - Nathan
Hi Nathan,
It has been a while, but I think the syntax was
$p0=somemenu $p0=* (pre 2006), where somemenu was defined in the mn* files. The macro could be assigned to a toolbar button in the .mn* files or CUI (I think).
I haven't tried this with the new CUI format to see if it's still valid, though. Does anyone else have an idea?
It does seem that they (the third party developer) may have used something like this, as when you click the button the cursor is right there, and the shortcut menu would act like a drop down in effect.
dsolak,
What version are you running?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.