IsValidPBEvent?[Resolved]

Just starting out? Need help? Post your questions and find answers here.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: IsValidPBEvent?

Post by collectordave »

Updating the string gadget with the SetGadgetText() function does not trigger any events. The event that is causing the loop to run is the paint event from the OS, to redraw the string gadget. And since that event is handled internally by PureBasic, no valid events are being routed through the message loop. Accordingly, EventWindow() correctly continues to return the value of the last active window.
So the setgadgettext() function does not trigger any events except the paint event from the OS? Pure Basic handles that internally then passes the event onto window 1 as an event on window 2. However the paint event is for window 1 as can be seen and as PB kmows as it does update the stringgadget on window 1 then sends the message to the event procedure telling the programme that the event happened on window 2? Sorry that is an error. Nowhere can I find that eventwindow() returns the value of the last active window just that it returns the value of the window on which the event happened. Noticed as well that after handling the paint event internally the event is passed on but is an invalid PB event.

Of course using the IsValid event procedure in the program fixes this.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply