WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
I call a child-form by clicking the checkbox in the parent-form. Child-form i also set a repeat to handle gadgets belonging to it.
i get the error:
WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
when i call show child-form.
What's the problem ?
i get the error:
WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
when i call show child-form.
What's the problem ?
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
Can you do a simplified example of how you do this? I'm sure that as long as you make an example, the problem will solve itself.
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
Youre ONE event loop is wrong.
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
There can only ever be one EventLoop with WaitWindowEvent() in the program.
WindowEvent() is only required for OpenWindowedScreen() to process all events in the screen loop.
WindowEvent() is only required for OpenWindowedScreen() to process all events in the screen loop.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
Hello mk-soft,
), but I don't quite agree with you.
In theory, it's preferable, but it is possible to have several event management loops in the same program.
I have a program whose main window contains a lot of gadgets. These gadgets open a multitude of other modal windows via a single procedure and, for the sake of code readability, all the gadgets in these windows are managed by another event loop.
Sorry, I know your great talent (which I can't compete withmk-soft wrote: There can only ever be one EventLoop with WaitWindowEvent() in the program.
In theory, it's preferable, but it is possible to have several event management loops in the same program.
I have a program whose main window contains a lot of gadgets. These gadgets open a multitude of other modal windows via a single procedure and, for the sake of code readability, all the gadgets in these windows are managed by another event loop.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
I am pretty sure this is a general design thing (as always with this kind of questions).
But without any (compilable) code, we can only guess here.
P.S.: Most likely another question where the questioner shows no reaction to our answers.
But without any (compilable) code, we can only guess here.
P.S.: Most likely another question where the questioner shows no reaction to our answers.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
Using WaitWindowEvent() within a procedure bound with BindEvent is forbidden because said WaitWindowEvent() could call a bound event which leads to another WaitWindowEvent() which calls a bound function...and so on.
Use PostEvent() to communicate between the event loop and other functions. You can use PostEvent() within the bound function.
Use PostEvent() to communicate between the event loop and other functions. You can use PostEvent() within the bound function.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
I remain of the opinion that there may only be one call of WaitWindowEvent() in the event loop in the programme. Unless you have a new window with its own event loop and no longer want to process the events from another window.boddhi wrote: Thu Jul 18, 2024 12:10 pm Hello mk-soft,Sorry, I know your great talent (which I can't compete withmk-soft wrote: There can only ever be one EventLoop with WaitWindowEvent() in the program.), but I don't quite agree with you.
In theory, it's preferable, but it is possible to have several event management loops in the same program.
I have a program whose main window contains a lot of gadgets. These gadgets open a multitude of other modal windows via a single procedure and, for the sake of code readability, all the gadgets in these windows are managed by another event loop.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
Give him the benefit of the doubt. Especially since not everyone's time zone is the same.Axolotl wrote: P.S.: Most likely another question where the questioner shows no reaction to our answers.![]()
Sometimes I've asked a question and not been able to return to the forums for a few days due to unforeseen circumstances or other priorities.
Or more often the time to digest the code(s) given to me and come back to comment on it.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
We are agreemk-soft wrote: I remain of the opinion that there may only be one call of WaitWindowEvent() in the event loop in the programme.
Your first post just missed a little nuance or precision (sometimes it's important for newbies in a domain. And on this subject, believe me, I know what I'm talking about!
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
I know and I am patient and (hopefully) always willing to help, but when I look at his posting history I see a pattern. Just an observation, not a criticism.boddhi wrote: Thu Jul 18, 2024 4:44 pmGive him the benefit of the doubt. Especially since not everyone's time zone is the same.Axolotl wrote: P.S.: Most likely another question where the questioner shows no reaction to our answers.![]()
![]()
Sometimes I've asked a question and not been able to return to the forums for a few days due to unforeseen circumstances or other priorities.
Or more often the time to digest the code(s) given to me and come back to comment on it.![]()
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
This error occurs when you do something like this, it's not supported:
Code: Select all
Global LastEvent
Procedure OnGadgetEvent()
LastEvent = WindowEvent()
Debug "An event!"
EndProcedure
OpenWindow(0, 100, 100, 200, 200, "Test", #PB_Window_SizeGadget | #PB_Window_SystemMenu)
EditorGadget(0, 10, 10, 180, 180)
BindEvent(#PB_Event_Gadget, @OnGadgetEvent(), #PB_All)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Code: Select all
Global LastEvent
Procedure OnGadgetEvent()
LastEvent = Event()
Debug "An event!"
EndProcedure
OpenWindow(0, 100, 100, 200, 200, "Test", #PB_Window_SizeGadget | #PB_Window_SystemMenu)
EditorGadget(0, 10, 10, 180, 180)
BindEvent(#PB_Event_Gadget, @OnGadgetEvent(), #PB_All)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Re: WindowEvent() and WaitWindowEvent() can not be called from a 'binded' event callback
Thank you for all your help.
Thanks @spikey.
Because my code is quite long and I want to maintain privacy, I did not include the code in the post.
I was able to fix the error in my code myself.
The keyword here is the Event() function.
Thanks @spikey.
Because my code is quite long and I want to maintain privacy, I did not include the code in the post.
I was able to fix the error in my code myself.
The keyword here is the Event() function.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.



