right-click on a ButtonGadget now you can use the code below (which should
also work for any gadget, actually).
But don't forget that most gadgets, after an event, can trigger an EventType()
of #PB_EventType_RightClick, so this code is really only useful for Buttons.
Code: Select all
; Original code by Danilo.
; Modified by PB, MLK and Trond.
If OpenWindow(0,200,200,200,200,"ButtonGadget Right-click",#PB_Window_SystemMenu)
  CreateGadgetList(WindowID(0))
  ButtonGadget(0,50,50,100,100,"Right-click me!")
  Repeat
    Select WaitWindowEvent()
      Case #WM_RBUTTONDOWN
        GetWindowRect_(GadgetID(0),@rect.RECT) : GetCursorPos_(@pt.POINT)
        If PtInRect_(@rect,pt\x,pt\y)
          Repeat : Sleep_(1) : Until GetAsyncKeyState_(#VK_RBUTTON)=0
          GetCursorPos_(@pt.POINT)
          If PtInRect_(@rect,pt\x,pt\y) : Debug "Right-click" : EndIf
        EndIf
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf




