Page 1 of 1

Key Alt and MouseMove in CanvasGadget

Posted: Tue May 15, 2012 8:44 am
by Stefou
Hi evrebody !!! 8)

I just find the CanvasGadget(), it's very nice ! Thank you to Fred and The Team, i'm begin my 100 program this week !!!

In CanvasGadget when you listing the #PB_EventType_MouseMove, the event stop when you push the Alt key down and up.
And the event restart when you push Alt key a second time.

Have a nice day.

Code: Select all

  If OpenWindow(0, 0, 0, 220, 220, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 10, 10, 200, 200)
    
    Repeat
      event = WaitWindowEvent()
      
      If event = #PB_Event_Gadget And EventGadget() = 0 
        Select EventType()
          Case #PB_EventType_MouseMove; ;Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
            Debug "MouseMove"
            
            
            
        EndSelect
        
      EndIf    
      
    Until event = #PB_Event_CloseWindow
  EndIf

Re: Key Alt and MouseMove in CanvasGadget

Posted: Tue May 15, 2012 9:17 am
by TI-994A
Stefou wrote:In CanvasGadget when you listing the #PB_EventType_MouseMove, the event stop when you push the Alt key down and up. And the event restart when you push Alt key a second time.
Hi Stefou. I believe that this is caused by the #PB_Window_SystemMenu flag when creating the window. The system menu gets the focus when the ALT key is pressed; you can see this by pressing the DOWN Arrow key after pressing the ALT key. Accordingly, removing the #PB_Window_SystemMenu flag from the window eliminates this behaviour.

Re: Key Alt and MouseMove in CanvasGadget

Posted: Tue May 15, 2012 9:41 am
by Stefou

Code: Select all

removing the #PB_Window_SystemMenu flag from the window eliminates this behaviour
Yes It's true ! But there is no probleme with the Ctrl or Shift key, then i think it's a bug.

Re: Key Alt and MouseMove in CanvasGadget

Posted: Tue May 15, 2012 10:10 am
by TI-994A
Stefou wrote:Yes It's true ! But there is no probleme with the Ctrl or Shift key, then i think it's a bug.
This is a Windows feature; in the absence of any user-defined menus in a window, the system menu will intercept the ALT key. And although CTRL and SHIFT are also modifier keys, they are not directly associated to any windows function at the system level.

To circumvent this behaviour, you can either remove the #PB_Window_SystemMenu flag, or subclass the window and trap the WM_SYSKEYDOWN message.

Re: Key Alt and MouseMove in CanvasGadget

Posted: Tue May 15, 2012 4:15 pm
by USCode
I think TI-994A is correct, no bug. Instead of hitting Alt the 2nd time, try hitting the down-arrow and you'll see the system menu pop up.
Then hit Alt again and you'll see the system menu go away and your events start again because the menu no longer has focus anymore.