Page 1 of 1

CanvasGadget() / Left- and Right-Click (was: Strange)

Posted: Wed Aug 28, 2024 7:52 pm
by Erlend
The below code on my Debian system is switched left is right and right is left, can someone confirm??

Code: Select all

OpenWindow(0,0,0,500,500,"")

CanvasGadget(0,0,0,495,495,#PB_Canvas_Border|#PB_Canvas_Keyboard)

Procedure Callback()
  ;Debug "event" 
  evgadget=EventGadget()
  *mem=GetGadgetData(evgadget)
  Select EventType()
    Case #PB_Canvas_RightButton
      Debug "Right"
    Case #PB_Canvas_LeftButton
      Debug "Left"  
  EndSelect     
EndProcedure

 BindEvent(#PB_Event_Gadget,@Callback(),0,0)  

Repeat
  event=WaitWindowEvent()
Until event=#PB_Event_CloseWindow
BR
Erlend

// Moved from "Bugs - Linux" to "Coding Questions" (Kiffi)

Re: CanvasGadget() / Left- and Right-Click (was: Strange)

Posted: Wed Aug 28, 2024 8:16 pm
by infratec
And from which PB version you are talking?

Re: CanvasGadget() / Left- and Right-Click (was: Strange)

Posted: Wed Aug 28, 2024 9:22 pm
by moulder61
On my Void Linux install using PB 6.11 LTS Beta 2, I can confirm that right click says left and double left click says right.

Moulder.

Re: CanvasGadget() / Left- and Right-Click (was: Strange)

Posted: Wed Aug 28, 2024 11:05 pm
by mk-soft
No Bug

You check with wrong constant ...

Code: Select all

OpenWindow(0,0,0,500,500,"")

CanvasGadget(0,0,0,495,495,#PB_Canvas_Border|#PB_Canvas_Keyboard)

Procedure Callback()
  ;Debug "event" 
  evgadget=EventGadget()
  *mem=GetGadgetData(evgadget)
  Select EventType()
    Case #PB_EventType_RightClick
      Debug "RightClick"
    Case #PB_EventType_LeftClick
      Debug "LeftClick"  
  EndSelect
  
  button = GetGadgetAttribute(evgadget, #PB_Canvas_Buttons)
  If button & #PB_Canvas_LeftButton
    Debug "Canvas LeftButton"
  EndIf
  If button & #PB_Canvas_RightButton
    Debug "Canvas RightButton"
  EndIf
  
EndProcedure

BindEvent(#PB_Event_Gadget,@Callback(),0,0)  

Repeat
  event=WaitWindowEvent()
Until event=#PB_Event_CloseWindow