November 28, 2020, 11:36:32 AM

Author Topic: [bmx] BlitzMax Event Killer by SebHoll [ 1+ years ago ]  (Read 689 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bmx] BlitzMax Event Killer by SebHoll [ 1+ years ago ]
« on: June 29, 2017, 12:28:43 AM »
Title : BlitzMax Event Killer
Author : SebHoll
Posted : 1+ years ago

Description : SuperStrict compliant, this function may not appear necessary to a lot of people, but I've found many uses in my projects, such as removing double-posted events from the system event queue etc.

Example: KillEvent(EVENT_WINDOWMOVE)


Code :
Code: BlitzMax
  1. Function KillEvent(pID%,pID2%=0)
  2.                
  3.                 Local tmpList:TList = New TList
  4.                
  5.                 PollSystem()
  6.                
  7.                 tmpList.AddFirst CurrentEvent;PollEvent
  8.                
  9.                 While EventID() <> Null
  10.                
  11.                         If Not (EventID() = pID Or EventID() = pID2) Then tmpList.AddLast CurrentEvent         
  12.                
  13.                         PollEvent()
  14.                
  15.                 Wend
  16.                
  17.                 For Local a:TEvent = EachIn tmpList
  18.                
  19.                         PostEvent(a)
  20.                
  21.                 Next
  22.                
  23.                 PollEvent()
  24.                
  25.                 tmpList.Clear()
  26.                 tmpList = Null
  27.  
  28. EndFunction


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal