#MSGF_MENU = 2 Procedure WindowCallback(hWnd.l,uMsg.l,wParam.l,lParam.l) Select uMsg Case #WM_ENTERIDLE If wParam = #MSGF_MENU GetClientRect_(lParam,mrc.RECT) SetGadgetText(1,"Breite: "+Str(mrc\right)) SetGadgetText(2,"Höhe: "+Str(mrc\bottom)) EndIf EndSelect ProcedureReturn #PB_ProcessPureBasicEvents EndProcedure If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) TextGadget(1,10,10,100,20,"Breite: 0",0) TextGadget(2,10,30,100,20,"Höhe: 0",0) If CreatePopupMenu(1) For a=1 To 5 MenuItem(a,"Item "+Str(a)) Next EndIf SetWindowCallback(@WindowCallback()) Repeat EventID=WaitWindowEvent() Select EventID Case #WM_RBUTTONDOWN DisplayPopupMenu(1,WindowID(0)) EndSelect If EventID=#PB_Event_CloseWindow Quit=1 EndIf Until Quit=1 EndIf