Key Alt and MouseMove in CanvasGadget

Just starting out? Need help? Post your questions and find answers here.
Stefou
User
User
Posts: 19
Joined: Thu May 29, 2008 8:40 am

Key Alt and MouseMove in CanvasGadget

Post 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
User avatar
TI-994A
Addict
Addict
Posts: 2741
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Key Alt and MouseMove in CanvasGadget

Post 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.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Stefou
User
User
Posts: 19
Joined: Thu May 29, 2008 8:40 am

Re: Key Alt and MouseMove in CanvasGadget

Post 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.
User avatar
TI-994A
Addict
Addict
Posts: 2741
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Key Alt and MouseMove in CanvasGadget

Post 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.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Key Alt and MouseMove in CanvasGadget

Post 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.
Post Reply