Popupmenu position

Just starting out? Need help? Post your questions and find answers here.
mrjiles
Enthusiast
Enthusiast
Posts: 238
Joined: Fri Aug 18, 2006 7:21 pm
Location: IL

Popupmenu position

Post by mrjiles »

I'm trying to position a popupmenu correctly, similar to a dropdown menu where the menu top is bottom aligned to the button. I believe I have it, but the menu appears a little lower than what I normally see. Is this a good way to do this, or is there a better way? Thanks for any input!

Code: Select all

OpenWindow(1, 0, 0, 500, 400, "Button Menu", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreatePopupMenu(1)
MenuItem(1, "Menu item 1")
MenuItem(2, "Menu item 2")
MenuItem(3, "Menu item 3")
MenuItem(4, "Menu item 4")
MenuItem(5, "Menu item 5")
ButtonGadget(1, 100,200, 200, 50, "Menu")
Repeat
	If EventGadget() = 1
		DisplayPopupMenu(1, WindowID(1), GadgetX(1,#PB_Gadget_ScreenCoordinate), GadgetY(1, #PB_Gadget_ScreenCoordinate)+GadgetHeight(1))
	EndIf
Until WaitWindowEvent() = #PB_Event_CloseWindow