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

Windows specific forum
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

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

Post 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
Last edited by dobro on Fri Apr 26, 2013 3:01 pm, edited 2 times in total.
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
User avatar
STARGÅTE
Addict
Addict
Posts: 2261
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

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

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

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

Post by luis »

:lol:

Again ...
"Have you tried turning it off and on again ?"
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

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

Post 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
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
User avatar
Demivec
Addict
Addict
Posts: 4282
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

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

Post 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.
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

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

Post 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
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
Post Reply