Page 1 of 2
[5.21] WindowTimers break EventWindow() of Windows events
Posted: Wed Dec 04, 2013 3:20 pm
by Niffo
In the code below, we can see that the EventWindow() of Windows #WM_CHAR events becomes false when a Window Timer is created.
If you comment the line "AddWindowTimer(), it works OK
Code: Select all
OpenWindow(0, 100, 100, 300, 200, "Main Window")
OpenWindow(1, 150, 150, 150, 150, "Child Window", 0, WindowID(0))
AddWindowTimer(0, 0, 100)
Repeat
Select WaitWindowEvent()
Case #WM_CHAR
Debug Str(EventWindow()) + " - " + Str(EventwParam())
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Wed Dec 04, 2013 3:41 pm
by STARGĂ…TE
I don't see #WM_CHAR as a PB-supported constant.
Please use a WindowCallback, if you want to use Windows-constants
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Thu Dec 05, 2013 2:28 pm
by leonhardt
Code: Select all
Procedure callback1(h,m,w,l)
If m=#WM_CHAR
Debug "0 -"+Str(w)
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Procedure callback2(h,m,w,l)
If m=#WM_CHAR
Debug "1 -"+Str(w)
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
OpenWindow(0, 100, 100, 300, 200, "Main Window")
OpenWindow(1, 150, 150, 150, 150, "Child Window", 0, WindowID(0))
SetWindowCallback(@callback1(),0)
SetWindowCallback(@callback2(),1)
AddWindowTimer(0, 0, 100)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
how about this?
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Thu Dec 05, 2013 4:53 pm
by Niffo
Thanks for your replies. Previously (in the older versions of PB) the WindowCallBack was not able to retrieve all the Windows messages this is why i was continuing to treat them in the main loop, but it seems it is solved in last versions of PB.
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Thu Dec 05, 2013 5:47 pm
by Denimus
1 August 2001 : Version 2.40
- Added: lot of new commands: EventLParam(), EventWParam(), ListIndex(), ListCount() and ChangeCurrentElement() ToolBarImageButton(), EventMouseButton(), UseDirectory()
So, using opportunity, why
this commands not documented at all? And some other are not connected to new or renamed one.
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Thu Dec 05, 2013 6:21 pm
by ts-soft
Denimus wrote:1 August 2001 : Version 2.40
- Added: lot of new commands: EventLParam(), EventWParam(), ListIndex(), ListCount() and ChangeCurrentElement() ToolBarImageButton(), EventMouseButton(), UseDirectory()
So, using opportunity, why
this commands not documented at all? And some other are not connected to new or renamed one.
EventLParam(), EventWParam() = not supported, use a callback!
ListCount(), EventMouseButton(), UseDirectory() are very old functions, from before PB 4.xx! To many changes from versions
< PB 4.xx. The most code < PB4.xx code not compatible to actuell ones!
The rest is documented.
Greetings - Thomas
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Fri Dec 06, 2013 12:02 am
by PB
> EventLParam(), EventWParam() = not supported
They're valid working commands, so they are supported.
Otherwise, why would they even exist and return a value?
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Fri Dec 06, 2013 12:58 am
by netmaestro
No, not supported. Merely tolerated (for now). This is what Fred has to say about EventWParam() and EventLParam():
http://www.purebasic.fr/english/viewtop ... 13&start=9
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Fri Dec 06, 2013 1:08 am
by PB
>
http://www.purebasic.fr/english/viewtop ... 13&start=9
When I click this link, I come to a page like this:
.
.
It shows page 1 of 1, with 11 posts, with no way to navigate to the
other 8 pages to verify what you're quoting. Obviously a forum bug.
BTW, I believe you; I'm just pointing out the bug.

Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Fri Dec 06, 2013 1:12 am
by netmaestro
Not a forum bug, I specified &start=9 so none of the previous posts show and there's only one page. If you take the &start=9 off the end of the link you'll get the whole topic. And then you'll discover that it was you who first brought it up in a code snippet. Then Sparkie weighed in with a question about the validity of the two commands and then Fred's response.
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Fri Dec 06, 2013 1:29 am
by PB
Okay, now I see all the posts. And yes, I used those commands
because they're supported for then (and still now).

Only when
they're actually removed they will be unsupported.
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Fri Dec 06, 2013 1:36 am
by netmaestro
Ok, well not to put too fine a point on it, but to me 'supported' means that if someone posted a bug report about one of those commands not working right, Fred would fix it. Imho he wouldn't and so I consider it unsupported. But like I say it's really too fine a point and we all understand pretty much how those commands stand, it's just semantics. Nobody's arguing about it and if my take is wrong I don't really care

It's all good.
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Fri Dec 06, 2013 1:52 am
by PB
> It's all good
+1

Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Mon Apr 07, 2014 4:52 pm
by Niffo
In fact, the use of a WindowCallback() does not solve my problem.
Unlike in the main loop, if a gadget of the window has the focus, the #WM_CHAR message is not anymore received.
That was the reason why i didn't use a WindowCallBack().
Re: [5.21] WindowTimers break EventWindow() of Windows event
Posted: Wed Apr 09, 2014 4:56 am
by Bisonte
Maybe AddKeyBoardShortCut() is your solution ?