add DisableEventProc(State=1[,#EventProc=0])

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

add DisableEventProc(State=1[,#EventProc=0])

Post by gurj »

add DisableEventProc(State=1[,#EventProc=0])
For WaitWindowEvent() And WindowEvent()

And change is:
WaitWindowEvent([Timeout[,#EventProc]]) And WindowEvent([#EventProc])

#EventProc is Procedure's numbering for WaitWindowEvent() and WindowEvent()
If #EventProc=0 ,is all Procedure of WaitWindowEvent() And WindowEvent()
If State = 0 it will be enabled
user how To realization? thanks!
Example:

Code: Select all

If OpenWindow(0,0,0,500,400,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
 ButtonGadget(0, 0, 0,200, 20, "Button 0")
 a=50:b=50
 Repeat:Event=WaitWindowEvent(5000)
  If Event
 Select Event
   Case #PB_Event_Gadget
    a=150-a:ResizeGadget(0,a,0,200, 20)
   Case #PB_Event_MoveWindow;******* please try this
    ;DisableEventProc(1);******* new
    b=200-b:ResizeWindow(0,b,180,500,400):Delay(100);Wait Resize perfect
   Case #PB_Event_CloseWindow:Quit = 1
  EndSelect
  ;DisableEventProc(0);******* new
EndIf:Until Quit = 1
EndIf
End
my pb for chinese:
http://ataorj.ys168.com
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: add DisableEventProc(State=1[,#EventProc=0])

Post by gurj »

ok:

Code: Select all

If OpenWindow(0,0,0,500,400,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
 ButtonGadget(0, 0, 0,200, 20, "Button 0")
 a=50:b=50
 Repeat:Event=WaitWindowEvent(5000)
  If Quit = 0:If Event
 Select Event
   Case #PB_Event_Gadget
    a=150-a:ResizeGadget(0,a,0,200, 20)
   Case #PB_Event_MoveWindow;******* please try this
    ;DisableEventProc(1);******* new
    Quit = 2:b=200-b:ResizeWindow(0,b,180,500,400):Delay(100);Wait Resize perfect
   Case #PB_Event_CloseWindow:Quit = 1
  EndSelect
  ;DisableEventProc(0);******* new
  EndIf:ElseIf Quit = 2:Quit = 0:EndIf:Until Quit = 1
EndIf
End
my pb for chinese:
http://ataorj.ys168.com
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: add DisableEventProc(State=1[,#EventProc=0])

Post by gurj »

way 2 Example:

Code: Select all

If OpenWindow(0,0,0,500,400,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
 ButtonGadget(0, 0, 0,200, 20, "Button 0")
 a=50:b=50
 Repeat:Event=WaitWindowEvent(5000)
  If Event
 Select Event
  Case #PB_Event_Gadget
    a=150-a:ResizeGadget(0,a,0,200, 20)
   Case #PB_Event_MoveWindow;******* please try this
    For a=1 To 3
     b=200-b:ResizeWindow(0,b,180,500,400)
     n+1:Delay(100);Wait Resize perfect
     Next
    
   Case #PB_Event_CloseWindow:Quit = 1
  EndSelect
  For m=1 To n:WaitWindowEvent():Next:n=0;******* ok,but isn't crashing
EndIf:Until Quit = 1
EndIf
End
my pb for chinese:
http://ataorj.ys168.com
Post Reply