Multiple WaitWindowEvent() in a single project (via include/procedure)?

Just starting out? Need help? Post your questions and find answers here.
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: Multiple WaitWindowEvent() in a single project (via include/procedure)?

Post by boddhi »

"All roads lead to Rome"

Some are faster but more restrictive,
Some are longer but more pleasant,
Some are faster but more expensive,
Some are longer but cost less.

The most important thing is to get to destination, and if there's more than one possible choice, so much the better.
User can then choose according to his/her objectives. :mrgreen:
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...
User avatar
jacdelad
Addict
Addict
Posts: 1992
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Multiple WaitWindowEvent() in a single project (via include/procedure)?

Post by jacdelad »

The real important thing is to know, that only ONE event loop is active at any given time. That's what it's all about!
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
User avatar
NicTheQuick
Addict
Addict
Posts: 1504
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Multiple WaitWindowEvent() in a single project (via include/procedure)?

Post by NicTheQuick »

TI-994A wrote: Thu Aug 08, 2024 5:12 pm Since many are suggesting the use of #PB_Any and the BindEvent() function, here's my earlier-posted code, free of enumerations and conventional message loops. Instead of binding each gadget and event individually, it's all bound and processed by consolidated handlers.
<...>

The modal window is now called in two short steps:
1. IncludeFile "myCommonWindow1.pbi"
3. showMyCommonWindow1(parentWindow [, relayGadget])

That's all! :wink:
Looks good now.

One additional idea for the future:
Instead of declaring a lot of global variables, you could also create a dedicated structure for each window. Each structure than has members for the window handle itself and for each gadget handle. You can also store additional information in that structure when needed. But the best thing: You now can create multiple windows of the same type. Just create a new variable with the same structure and you're done. This of course only makes sense if you need a window type that can be instantiated multiple types. For example when you want to open multiple property windows, one for each file you double clicked on or something similar.
That's btw also the idea I had in my Youtube video that I linked in my last post.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Post Reply