Page 1 of 1

hope BindEvent() supported more Event

Posted: Fri Mar 01, 2019 5:02 pm
by gurj
hope BindEvent() supported more Event,
Message events that want BindEvent() to support any 32-bit binary natural value.

Code: Select all

;TODO hope BindEvent() supported more Event

Procedure wm_systimer()
 Debug 1
EndProcedure

OpenWindow(0, 100, 100, 200, 200, "BindEventEx", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
EditorGadget(0, 10, 10, 180, 180)
#wm_systimer=280
BindEvent(#wm_systimer, @wm_systimer())
SetActiveGadget(0)
Repeat
 Event = WaitWindowEvent()
 If Event = #wm_systimer
  Debug 0
 EndIf
Until Event = #PB_Event_CloseWindow


Re: hope BindEvent() supported more Event

Posted: Fri Mar 01, 2019 5:57 pm
by Bisonte
MSDN wrote:The WM_SYSTIMER message is an undocumented message, it is used for caret blink. In fact, there is no the #define WM_SYSTIMER.
Why should it on PB ?

Re: hope BindEvent() supported more Event

Posted: Fri Mar 01, 2019 6:55 pm
by gurj
thanks Bisonte!
Sorry, updated the topic ...

Re: hope BindEvent() supported more Event

Posted: Sat Mar 02, 2019 11:17 am
by mk-soft

Code: Select all

;TODO hope BindEvent() supported more Event

Enumeration CustomEvents #PB_Event_FirstCustomValue
  #MyEvent_SysTimer
EndEnumeration

; ----

#wm_systimer = $118

Procedure WinCB(hWnd, uMsg, wParam, lParam)
  
  Select uMsg
    Case #wm_systimer
      PostEvent(#MyEvent_SysTimer)
  EndSelect
  
  ProcedureReturn #PB_ProcessPureBasicEvents 
  
EndProcedure

; ----

Procedure wm_systimer()
 Debug "MyEvent_SysTimer"
EndProcedure

SetWindowCallback(@WinCB())

OpenWindow(0, 100, 100, 200, 200, "BindEventEx", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
EditorGadget(0, 10, 10, 180, 180)
BindEvent(#MyEvent_SysTimer, @wm_systimer())
SetActiveGadget(0)

Repeat
 Event = WaitWindowEvent()
 If Event = #wm_systimer
  Debug 0
 EndIf
Until Event = #PB_Event_CloseWindow

Re: hope BindEvent() supported more Event

Posted: Sat Mar 02, 2019 1:29 pm
by gurj
Thanks to mk-soft!
I've changed my mind now, though.
I guess the selection command is also used at the bottom of the BindEvent(), which is shoddy. I plan to use virtual tables and use GoTo directly.
See: viewtopic.php?f=12&t=71749