Page 2 of 2
Re: Multiple WaitWindowEvent() in a single project (via include/procedure)?
Posted: Thu Aug 08, 2024 5:45 pm
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.

Re: Multiple WaitWindowEvent() in a single project (via include/procedure)?
Posted: Thu Aug 08, 2024 5:57 pm
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!
Re: Multiple WaitWindowEvent() in a single project (via include/procedure)?
Posted: Thu Aug 08, 2024 6:59 pm
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!
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.