It is currently Fri Jun 22, 2018 6:41 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: [Done] Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 5:47 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1575
Location: Uttoxeter, UK
A number of my programs which worked in 5.60B2 do not work in 5.60 final.

I've listed a demo from the manual for CanvasGadget and its translation to dialog.
The dialog version works in 5.60B2 but not in 5.60 final.
Could somebody confirm, please.
My system PureBasic 5.60x64 on Windows 10.

Many thanks in anticipation.

Dialog version:
Code:
  #XmlEncoding = #PB_UTF8

  #Dialog = 0
  #Xml = 0
 
  Runtime   Procedure EventCanvas0()
     Debug "££££"
     If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
        If StartDrawing(CanvasOutput(0))
           x = GetGadgetAttribute(0, #PB_Canvas_MouseX)
           y = GetGadgetAttribute(0, #PB_Canvas_MouseY)
           Circle(x, y, 10, RGB(Random(255), Random(255), Random(255)))
           StopDrawing()
        EndIf
     EndIf
  EndProcedure
 
 
  XML$ = "<window id='#PB_Any' name='test' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
         "  <canvas id='0' width='200' height='200' onevent='EventCanvas0()'/>"+
         "</window>"
 
  If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
   
    If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
     
      Repeat
        Event = WaitWindowEvent()
      Until Event = #PB_Event_CloseWindow
     
    Else 
      Debug "Dialog error: " + DialogError(#Dialog)
    EndIf
  Else
    Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
  EndIf


Demo from manual:
Code:
  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
        If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
          If StartDrawing(CanvasOutput(0))
            x = GetGadgetAttribute(0, #PB_Canvas_MouseX)
            y = GetGadgetAttribute(0, #PB_Canvas_MouseY)
            Circle(x, y, 10, RGB(Random(255), Random(255), Random(255)))
            StopDrawing()
          EndIf
        EndIf
      EndIf   
     
    Until Event = #PB_Event_CloseWindow
  EndIf


_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 6:43 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3012
Hi davido
No bug

Code:
 #XmlEncoding = #PB_UTF8

  #Dialog = 0
  #Xml = 0
 
Runtime   Procedure EventCanvas0()
     Debug "££££"
     If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
        If StartDrawing(CanvasOutput(0))
           x = GetGadgetAttribute(0, #PB_Canvas_MouseX)
           y = GetGadgetAttribute(0, #PB_Canvas_MouseY)
           Circle(x, y, 10, RGB(Random(255), Random(255), Random(255)))
           StopDrawing()
        EndIf
     EndIf
EndProcedure
 
 
  XML$ = "<window id='#PB_Any' name='test' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
         "  <canvas id='0' width='200' height='200' onevent='EventCanvas0()'/>"+
         "</window>"
 
  If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
   
    If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
     
      Repeat
        Event = WaitWindowEvent()
        If Event = #PB_Event_Gadget And EventGadget() = 0
          EventCanvas0()
        EndIf
      Until Event = #PB_Event_CloseWindow
     
    Else
      Debug "Dialog error: " + DialogError(#Dialog)
    EndIf
  Else
    Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
  EndIf

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 7:19 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1575
Location: Uttoxeter, UK
@RASHAD,
I still think it is a bug because you have, cleverly, bypassed the BindEvent.
BindEvent should work and, indeed it does, on PureBasic 5.6B2.
I only use BindEvent and all the others appear to work as they should.
Sorry to disagree with you on this one.

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 8:17 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3012
CanvasGadget() do not support Event but EventType
Also ContainerGadget(),PanelGadget(),TextGadget(),FrameGadget().....
Canvas takes it's response from moving mouse

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 8:50 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 7971
Location: Kelowna, BC, Canada
That's very likely a regression bug as the code should work as written. The fact that it used to work in an earlier beta pretty much seals it.

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 9:00 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 7971
Location: Kelowna, BC, Canada
Got 5.50 out of the museum and confirmed the code working as posted. A bug sneaked in since then.

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 9:31 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1575
Location: Uttoxeter, UK
@netmaestro,
Thank you for taking so much trouble to confirm. :D
Could a Moderator, please, move this to the bugs section.

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 11:27 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 6:14 pm
Posts: 1559
Location: Germany (Saxony, Deutscheinsiedel)
davido wrote:
@netmaestro,
Thank you for taking so much trouble to confirm. :D
Could a Moderator, please, move this to the bugs section.

Done :)

_________________
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 03, 2017 11:54 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1575
Location: Uttoxeter, UK
@Andre,
Thank you.

I've just checked the code on my MacBook Pro.
The problem also occurs on Mac OSX.

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Tue Jul 11, 2017 3:44 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13304
Location: France
Fixed.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 09, 2018 12:08 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Dec 18, 2004 11:56 am
Posts: 437
Location: Vienna - Austria
Fred, I'm not sure if this issue is completely solved, it's even possible that what I'm experiencing is something "completely" different but it just sounds/looks pretty comparable - which is the reason I'm putting this here in this thread:

I have the strong impression that (even with the latest version of Purebasic) under Windows 7 the eventtype "#PB_EventType_MouseWheel" cannot be reacted to as it's just not received/triggered. I have plenty of VMs with Windows 7 on them and they all have this problem, while the same code, yes even the same compiled executable, works under Windows 10. I'm not sure if that's just bound to Win7-VMs as I don't have a physical Win7 box anymore. (Can anyone verify?)

For verification I used your CanvasGadget example and put a "Debug Type" instruction after the "Type = EventType()" instruction and I do not even see/get a different number for scrollwheel activity, just if it didn't happen, just nothing at all. Other gadgets seem to work properly, though.

_________________
Go, tell it on the mountains.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Fri Mar 09, 2018 5:34 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1255
Location: Germany
The problem is that the event type MouseWheel on Windows 7 only comes when the canvas gadget has the focus.
With windows 10 this has partly changed.

See this thread:
viewtopic.php?f=12&t=70074&hilit=%23PB_EventType_MouseWheel

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Sun Mar 11, 2018 6:49 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Dec 18, 2004 11:56 am
Posts: 437
Location: Vienna - Austria
mk-soft wrote:
The problem is that the event type MouseWheel on Windows 7 only comes when the canvas gadget has the focus.
With windows 10 this has partly changed.

See this thread:
viewtopic.php?f=12&t=70074&hilit=%23PB_EventType_MouseWheel


Thx a lot, that was a good pointer! Using the flag for receiving the keyboard events also got me rid of my mousewheel issue, lol :-)

_________________
Go, tell it on the mountains.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Possible bug in PB5.60 in Dialog/BindEvent/Canvas
PostPosted: Sun Mar 11, 2018 11:41 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1553
This is in the help file :)

Quote:
#PB_Canvas_Keyboard : Allows the gadget to receive the keyboard focus and keyboard events.

Quote:
On Windows, the #PB_EventType_MouseWheel event is also only reported if the gadget has keyboard focus.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye