No, it's not needed. You have to respond to specific events, so even if EventWindow() isn't -1 for an OS event (which can be the case as PB sometimes maps PB event constant values with real OS event value for historical reasons) and you don't have it in your Select/Case, it won't be processed. So in both way, you can't have any issues.
Absolutely! Thanks for the concise explanation, Fred.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!Please visit my YouTube Channel
Sorry but I do accept it. Once the event has been routed to the correct window i check for specific PB events.
The code also works fine.
No help required with this.
The issue is that EventWindow() returns the window number\ID of the last window on which a valid PB event happened even when non valid PB events happen. It does not return -1 for non valid PB events in every case. As stated elsewhere the return value of EventWindow() is only guaranteed after a valid PB event.
This procedure simply checks that a valid PB event has occurred and is used before routing the event to the correct window using EventWindow().
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.
collectordave wrote:Sorry but I do accept it... This procedure simply checks that a valid PB event has occurred and is used before routing the event to the correct window using EventWindow().
But as Fred has clearly said, it's not needed. So, you're not accepting it.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!Please visit my YouTube Channel
The issue is that EventWindow() returns the window number\ID of the last window on which a valid PB event happened even when non valid PB events happen. It does not return -1 for non valid PB events in every case. As stated elsewhere the return value of EventWindow() is only guaranteed after a valid PB event.
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.
Fred wrote:Well your posted code is wrong, as you don't check for any specific events, but you don't seem to accept it, so I will stop trying to help here.
collectordave wrote:This discussion shows that it is needed.
The main issue in all the "event and eventwindow" discussions started here by you is, that you refuse to learn some simple basic rules how things are working in PureBasic. This has to be stated clearly, so that other newbies who'll read these threads won't get the wrong impression that PureBasic has got a problem in this regard.
The main issue in all the "event and eventwindow" discussions started here by you is, that you refuse to learn some simple basic rules how things are working in PureBasic. This has to be stated clearly, so that other newbies who'll read these threads won't get the wrong impression that PureBasic has got a problem in this regard.
At no point have I even suggested that PB has a problem in this regard.
In fact I believe after my few months looking at Pb that it is a powerfull programming tool that outstrips VB except for all the control support VB has. i have learn't the rules.
A quick simple example.
I am told that i can enter the kitchen only when the door is open. So i check the door is open and if t is i enter the kitchen. i casn write this as.
If KitchenDoorOpen
enter kitchen
endif
Of course i can now change these around to
If IsValidPBEvent()
use eventwindow
endif
As i have been told that eventwindow() only returns a valid window number etc after a valid window event
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.
The good thing with coding is, anyone can do whatever he wants to.
If collectordave wants to use a totaly useless procedure ... no problem, just do it.
But isn't it strange, that no one of the other few thousand PB-users ever were in need of something like this?