ACC: How to Create Floating Pop-Up Menus (1.x/2.0)ID: Q95444
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article describes how to create "floating" pop-up menus using a
combination of Microsoft Windows application programming interface (API)
calls and Access Basic code.
To create a floating pop-up menu, follow these steps:
List Box Properties
----------------------------------------------
ControlName: Menu
RowSourceType: Value List
RowSource: String1;String2;String3;String4
AfterUpdate: =ItemSelected([Menu])
Left: 0 in
Top: 0 in
FontName: System
FontSize: 8
FontWeight: Bold
Form Properties
------------------------------------------------
ScrollBars: Neither
Popup: Yes
RecordSelectors: No
Width: <Width of the list box control>
Section Properties
-------------------------------------------------
Height: <Height of the list box control>
Option Explicit
Type POINTAPI
x As Integer
y As Integer
End Type
Global Const GWL_STYLE = (-16)
Global Const WS_DLGFRAME = &H400000
Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI)
Declare Function GetWindowLong& Lib "User" (ByVal hWnd%, _
ByVal nIndex%)
Declare Function SetWindowLong& Lib "User" (ByVal hWnd%, _
ByVal nIndex%, ByVal dwNewLong&)
Function ShowPopup ()
Dim coord As POINTAPI
Dim attr&
GetCursorPos coord
DoCmd OpenForm "Pop-up Menu Form"
attr& = GetWindowLong(Forms![Pop-up Menu Form].hWnd, GWL_STYLE)
attr& = SetWindowLong(Forms![Pop-up Menu Form].hWnd, GWL_STYLE, _
attr& And Not WS_DLGFRAME)
DoCmd MoveSize (coord.x * 14), (coord.y * 14), , 1100
End Function
Function ItemSelected (WhichItem As String)
DoCmd Close
MsgBox "The selected item was " & Trim(WhichItem)
End Function
=ShowPopup()
Additional query words: shortcut adt
Keywords : kbprg
Version : 1.0 1.1 2.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 18, 1999