[5.21] WindowTimers break EventWindow() of Windows events

Just starting out? Need help? Post your questions and find answers here.
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

[5.21] WindowTimers break EventWindow() of Windows events

Post 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
Niffo
User avatar
STARGÅTE
Addict
Addict
Posts: 2235
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
leonhardt
Enthusiast
Enthusiast
Posts: 220
Joined: Wed Dec 23, 2009 3:26 pm

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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?
poor English...

PureBasic & Delphi & VBA
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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.
Niffo
Denimus
User
User
Posts: 17
Joined: Sun Feb 10, 2013 1:04 pm
Location: Miami-Dade

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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
BERESHEIT
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post by PB »

> http://www.purebasic.fr/english/viewtop ... 13&start=9

When I click this link, I come to a page like this:

.
Image

.
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. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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.
BERESHEIT
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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 :mrgreen: It's all good.
BERESHEIT
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post by PB »

> It's all good

+1 :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Niffo
Enthusiast
Enthusiast
Posts: 504
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post 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().
Niffo
User avatar
Bisonte
Addict
Addict
Posts: 1313
Joined: Tue Oct 09, 2007 2:15 am

Re: [5.21] WindowTimers break EventWindow() of Windows event

Post by Bisonte »

Maybe AddKeyBoardShortCut() is your solution ?
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Post Reply