Procedure DisplayMenuInGadget(Window.l, Gadget.l, Menu.l) Protected Rect.rect, Pt.point GetClientRect_(GadgetID(Gadget), @Rect) Pt\x = Rect\left - 1 Pt\y = Rect\bottom ClientToScreen_(GadgetID(Gadget), @Pt) DisplayPopupMenu(Menu, WindowID(Window), Pt\x, Pt\y) EndProcedure If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) ButtonGadget(1,10,10,100,20,"Menü öffnen",0) If CreatePopupMenu(1) For a=1 To 5 MenuItem(a,"Testitem "+Str(a)) Next EndIf Repeat EventID=WaitWindowEvent() If EventID=#PB_Event_Gadget Select EventGadget() Case 1 DisplayMenuInGadget(0,1,1) EndSelect EndIf If EventID=#PB_Event_CloseWindow Quit=1 EndIf Until Quit=1 EndIf