I usually write console apps or simple windowed apps where every routine is run from a button press.
Now I am doing this simple window app where once Start button is pressed the routine with continue forever.
I have tried various things but none successful.
I tried searching these forums but just got page after page of other stuff so I am not able to make the search query more precise.
Now how do I detect the stop button being pressed once the start is running.
I have a simple example to illustrate. Press Start, then press stop.
Code: Select all
If OpenWindow(0, 100, 200, 80, 60, "Test...")
ButtonGadget(2, 10, 1, 75, 25, "Start")
ButtonGadget(3, 10, 30, 75, 25, "Stop")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget() = 2
Repeat
Debug Date()
ForEver
EndIf
If EventGadget() = 3
Event = #PB_Event_CloseWindow
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
End

Thanks