Page 1 of 1

Bug PB V 5.11 #WM_LBUTTONUP /#WM_RBUTTONUP [ok Solved]

Posted: Fri Apr 26, 2013 11:00 am
by dobro
looseness of the left button / right / middle mouse
is no longer recognized by PureBasic

use constants: # WM_LBUTTONUP / # WM_RBUTTONUP
does not seem to make their effects

le relachement des bouton gauche/droite de la souris n'est plus reconnu en V5.11
les constantes # WM_LBUTTONUP / # WM_RBUTTONUP et peut etre #WM_MBUTTONUP
ne semble plus repondre

Code: Select all

 ; Auteur : Le Soldat Inconnu, Fred
; Version de PB : 3.90
;
; Explication du programme :
; Détection des différents état de la souris - Appuyer sur le bouton gauche, relacher le bouton gauche, double clic, etc ...

#WM_MOUSEWHEEL = $20A
#WHEEL_DELTA = 120
#text=1
If OpenWindow(0, 0, 0, 200, 200, "Souris",#PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    
    SetClassLong_(WindowID(0), #GCL_STYLE, GetClassLong_(WindowID(0), #GCL_STYLE) | #CS_DBLCLKS) ; Active la gestion du double clic
    
    CreateImage(0, 200, 100)
    StartDrawing(ImageOutput(0))
    DrawingMode(1)
    FrontColor(RGB(255, 255, 255))
    DrawText(5,5,"Marche pas sur l'image :")
     DrawText(5,20,"Bouton gauche appuyé")
     DrawText(5,35,"Double clic gauche")
    StopDrawing()
    
    
    ImageGadget(0, 0, 0, 200, 100, ImageID(0))
    SetWindowLong_(GadgetID(0), #GWL_STYLE, GetWindowLong_(GadgetID(0), #GWL_STYLE) & ~#SS_NOTIFY)
    
    TextGadget(#text, 1, 150, 200, 50, "appuis touche souris") 
    Repeat
        Event = WaitWindowEvent() 
        If Event = #WM_LBUTTONDOWN
            SetGadgetText(#text, "Bouton gauche appuyé") 
          ElseIf Event = #WM_LBUTTONUP
           SetGadgetText(#text,"Bouton gauche relaché")  ; < ------------------------- Bug  !!!  no effect
        ElseIf Event = #WM_LBUTTONDBLCLK
            SetGadgetText(#text,"Double clic gauche") 
        ElseIf Event = #WM_RBUTTONDOWN
           SetGadgetText(#text,"Bouton droit appuyé")
            
        ElseIf Event = #WM_RBUTTONUP
            SetGadgetText(#text,"Bouton droit relaché")  ; < ------------------------- Bug  !!!  no effect
        ElseIf Event = #WM_RBUTTONDBLCLK
           SetGadgetText(#text,"Double clic droit") 
        ElseIf Event = #WM_MBUTTONDOWN
            SetGadgetText(#text,"Bouton du milieu appuyé") 
        ElseIf Event = #WM_MBUTTONUP
            SetGadgetText(#text,"Bouton du milieu relaché") 
        ElseIf Event = #WM_MBUTTONDBLCLK
           SetGadgetText(#text,"Double clic du milieu") 
        ElseIf Event = #WM_MOUSEWHEEL
            Molette.l = -(EventwParam() >> 16) / #WHEEL_DELTA
            If Molette > 0
              SetGadgetText(#text,"Molette en avant de " + Str(Molette))
            ElseIf Molette < 0
                SetGadgetText(#text,"Molette en arrière de " + Str(Molette))
            EndIf
            
        ElseIf Event = #PB_Event_Gadget
            Select EventGadget()
                Case 0
                    Select EventType()
                        Case #PB_EventType_LeftClick
                           SetGadgetText(#text,"Gadget : Bouton gauche appuyé")
                        Case #PB_EventType_LeftDoubleClick
                           SetGadgetText(#text,"Gadget : Double clic gauche")
                    EndSelect
            EndSelect
        EndIf
        
    Until Event = #WM_CLOSE
EndIf

Re: Bug PB V 5.11 #WM_LBUTTONUP /#WM_RBUTTONUP no effect

Posted: Fri Apr 26, 2013 11:02 am
by STARGÅTE
#WM_ is no PureBasic Event !!!
http://www.purebasic.fr/english/viewtop ... =4&t=54464

use: #PB_Event_LeftClick and #PB_Event_RightClick

Re: Bug PB V 5.11 #WM_LBUTTONUP /#WM_RBUTTONUP no effect

Posted: Fri Apr 26, 2013 11:07 am
by luis
:lol:

Again ...

Re: Bug PB V 5.11 #WM_LBUTTONUP /#WM_RBUTTONUP no effect

Posted: Fri Apr 26, 2013 11:35 am
by dobro
when I opened this topic, I ignored the Unknown Soldat inconnu, already opened his;)


answer that is not an Event Purebasic, have no meaning

as constants

# WM_LBUTTONDOWN
# WM_LBUTTONDBLCLK
# WM_RBUTTONDOWN
# WM_MOUSEWHEEL

do not have either, and yet they are recognized

Re: Bug PB V 5.11 #WM_LBUTTONUP /#WM_RBUTTONUP no effect

Posted: Fri Apr 26, 2013 2:29 pm
by Demivec
dobro wrote:answer that is not an Event Purebasic, have no meaning

as constants

# WM_LBUTTONDOWN
# WM_LBUTTONDBLCLK
# WM_RBUTTONDOWN
# WM_MOUSEWHEEL

do not have either, and yet they are recognized
The OS constants are for OS events, not PureBasic ones (even if they are for the same type of event and have the same value).

The events generated by windows may be filtered or changed before they are reported by the PureBasic functions such as WindowEvent(). This is because there is no guarantee that they won't be.

Because you and Unknown Soldat Inconnu are troubled by the same thing it looks like something changed. If you want to use the OS's event constants then use a OS based event loop. Fred has always recommended this instead of mixing OS events and commands with PureBasic ones in the same event loop.

Re: Bug PB V 5.11 #WM_LBUTTONUP /#WM_RBUTTONUP [ok Solved]

Posted: Fri Apr 26, 2013 3:02 pm
by dobro
Fred explained the French Forum need to use Constants # Wm ****
only in a callback!

for me the problem is solved

Thank you to all