Event LeftClick: only when release + only occasionally

Mac OSX specific forum
Lebostein
Addict
Addict
Posts: 854
Joined: Fri Jun 11, 2004 7:07 am

Event LeftClick: only when release + only occasionally

Post by Lebostein »

The #PB_EventType_LeftClick on Mac OS drives me crazy!

1. I get this event only if I release the mouse button (on Windows: if mouse button is pressed)
2. This event occurs only, if I click very short! If I hold some milliseconds, NO event occurs

Is this a bug?
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Event LeftClick: only when release + only occasionally

Post by WilliamL »

I see what you mean. The right-click and the left-click behave differently (in this example). The right-click gives an event immediately but the left-click doesn't respond until the button is released. I do not have any problem with the left-click giving an event whether I hold it for a short or long period.

Code: Select all

If OpenWindow(0, 0, 0, 230, 120, "Eventtypes example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
     ListIconGadget(1, 10, 10, 150, 100, "ListIcon", 140, #PB_ListIcon_GridLines) 
     For a = 1 To 4 
       AddGadgetItem(1, -1, "Line "+Str(a)) 
     Next
  
     Repeat
       Event = WaitWindowEvent()
       
       Select Event
       
         Case #PB_Event_Gadget
           Select EventGadget()
             Case 1 
               Select EventType()
                 Case #PB_EventType_LeftClick        : Debug "Click with left mouse button"
                 Case #PB_EventType_RightClick       : Debug "Click with right mouse button"
                 Case #PB_EventType_LeftDoubleClick  : Debug "Double-click with left mouse button"
                 Case #PB_EventType_RightDoubleClick : Debug "Double-click with right mouse button"
               EndSelect
           EndSelect
       
       EndSelect
     Until Event = #PB_Event_CloseWindow
  EndIf
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
Lebostein
Addict
Addict
Posts: 854
Joined: Fri Jun 11, 2004 7:07 am

Re: Event LeftClick: only when release + only occasionally

Post by Lebostein »

It seems a problem with the ImageGadget! If you click short, the you get an event, if the mouse button is released. If you hold some milliseconds, no event occurs.

Code: Select all

CreateImage(0, 230, 120)
If OpenWindow(0, 0, 0, 230, 120, "Eventtypes example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
     ImageGadget(1, 0, 0, 0, 0, ImageID(0)) 

     Repeat
       Event = WaitWindowEvent()
       
       Select Event
       
         Case #PB_Event_Gadget
           Select EventGadget()
             Case 1 
               Select EventType()
                 Case #PB_EventType_LeftClick        : Debug "Click with left mouse button"
                 Case #PB_EventType_RightClick       : Debug "Click with right mouse button"
                 Case #PB_EventType_LeftDoubleClick  : Debug "Double-click with left mouse button"
                 Case #PB_EventType_RightDoubleClick : Debug "Double-click with right mouse button"
               EndSelect
           EndSelect
       
       EndSelect
     Until Event = #PB_Event_CloseWindow
  EndIf
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Event LeftClick: only when release + only occasionally

Post by WilliamL »

Yikes, with your example I get all sorts of problems! The right-click will repeat after holding it down a while or it doesn't respond at all. Sometime the left-click doesn't respond. It's all very random. I was going to say that it works ok if you just click with a normal short deliberate click but that doesn't always work either. I'm wondering if it affects all the clicking events and so all gadgets or if it is confined to the Image gadget even though the clicking behavior is not the same with the ListIcon gadget (as shown above).

I can just imagine Fred getting a headache...
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
Post Reply