Page 1 of 1

canvas events

Posted: Tue Jan 04, 2022 11:24 pm
by mestnyi

Code: Select all

Procedure Open( id, flag=0 )
   Static x,y
   OpenWindow( id, x,y,200,200,"window_"+Str(id), #PB_Window_SystemMenu|flag)
   CanvasGadget( id, 40,40,200-80,55, #PB_Canvas_Keyboard | #PB_Canvas_Container) : CloseGadgetList()
   CanvasGadget( 10+id, 40,110,200-80,55, #PB_Canvas_Keyboard)
   x + 100
   y + 100
EndProcedure


Open(1, #PB_Window_NoActivate)
Open(2, #PB_Window_NoActivate)
;Open(3, #PB_Window_NoActivate)

Define gadget, down
Repeat
   event = WaitWindowEvent(1)
   
   Select event
      Case #PB_Event_ActivateWindow
         Debug "active - "+ EventWindow() 
         
      Case #PB_Event_DeactivateWindow
         Debug "deactive - "+ EventWindow()
         
      Case #PB_Event_Gadget
         Select EventType()
            Case #PB_EventType_Focus
               Debug "focus - "+EventGadget()
               
            Case #PB_EventType_LostFocus
               Debug "lostfocus - "+EventGadget()
               
            Case #PB_EventType_LeftButtonDown
               Debug "down - "+EventGadget()
               
            Case #PB_EventType_LeftButtonUp
               Debug "up - "+EventGadget()
               
            Case #PB_EventType_LeftClick
               Debug "click - "+EventGadget()
               
         EndSelect
         
   EndSelect
   
Until event = #PB_Event_CloseWindow

Re: Fixed canvas events

Posted: Wed Jan 05, 2022 4:13 pm
by jacdelad
GetDlgCtrlID_ causes problems on x64 systems an PB 6.0 Alpha 5, however, mk-soft pointed out that "GetProp_(Handle, "pb_id")" works as intended (I use it since then without problems. Just to mention, don't know if it will be relevant in the future.
https://www.purebasic.fr/english/viewto ... 62#p577962

Re: Fixed canvas events

Posted: Sun Feb 13, 2022 5:13 pm
by mestnyi
jacdelad wrote: Wed Jan 05, 2022 4:13 pm GetDlgCtrlID_ causes problems on x64 systems an PB 6.0 Alpha 5, however, mk-soft pointed out that "GetProp_(Handle, "pb_id")" works as intended (I use it since then without problems. Just to mention, don't know if it will be relevant in the future.
https://www.purebasic.fr/english/viewto ... 62#p577962
Thank you, I re-uploaded the code, thank you, it turned out as I wanted.

Re: Fixed canvas events

Posted: Mon Feb 14, 2022 4:18 am
by Rinzwind
jacdelad wrote: Wed Jan 05, 2022 4:13 pm GetDlgCtrlID_ causes problems on x64 systems an PB 6.0 Alpha 5, however, mk-soft pointed out that "GetProp_(Handle, "pb_id")" works as intended (I use it since then without problems. Just to mention, don't know if it will be relevant in the future.
https://www.purebasic.fr/english/viewto ... 62#p577962
Apparently fixed in beta 4? Can't reproduce.

Re: canvas events

Posted: Mon Sep 16, 2024 8:56 pm
by mestnyi
viewtopic.php?p=579118#p579118
When you click on the first gadget in the first window, then on the first gadget in the second window and again on the first gadget in the first window

Code: Select all

; first window
active - 1
focus - 1
down - 1
up - 1
click - 1
; second window
deactive - 1
active - 2
lostfocus - 1
focus - 2
down - 2
up - 2
click - 2
; first window
deactive - 2
lostfocus - 2
focus - 1
active - 1
lostfocus - 1
focus - 1
down - 1
up - 1
click - 1
Isn't this a mistake, shouldn't there be a different sequence of events?