Hi Peter, thanks for the wealth of ideas!
Based on what you had shared previously, I really looked again hard at the code to try to figure out what was being “concurrently modified.” And I realized I was looking in the wrong place. I was trying to see what was being modified in the GWindow, not realizing the GWindow was modifying the main sketch window! I was looking at it backwards.
When I saw that, I put a noLoop() in front of the offending code, and a loop() after, and the concurrent errors seem to have gone! Time will tell. But that’s based on your comment that it’s the draw method that gets angry when it’s messed with outside of the main sketch. That’s why I tried the noLoop deal. Which seems to work…I’ll post back if it still breaks.
This doesn’t solve the issue of a robust messaging solution, however.
From the sounds of your message, I would think asynchronous dialogs would be better - modal really, so nothing can be done outside the box until it’s dismissed - because in all actuality the user should not be doing anything in the main window if a dialog box is open first.
In fact I also tried disabling all the controls on the main window when a GWindow is open, but that also failed - because if the user clicks the “x” to close the window from the OS, then my code to reenable the controls on the main window weren’t called, and the app was dead. And I don’t know how to call a function when a GWindow is closed - is there a callback for that, if the user clicks the OS “x” and closes it without using a button?
This is a REALLY tricky thing to do well!!! I mean it’s one thing to cobble together a few lines of code to get something done, and quite another to develop a robust app that is well behaved. I have such hugely massive respect for programmers now!!!
I have already reduced the windows needed to about 5 - I was exaggerating when I said 47 but it felt like it. So I’m reusing 5 windows and attaching different event handlers depending on how it’s called.
Kludgy. Incredibly kludgy and messy. It works. But I’m not proud of it. It means part of the code that called the dialog has to finish in the dialog box code. Truly horrible.
I’m certain I can do this better. I will keep thinking about it. Maybe I just need to make some global variables to capture user selections for button for each window and handle it that way. Don’t know why I didn’t think of that before.
Honestly it would be amazing if someone created a robust modal messaging library, complete with the ability to add custom icons, play sounds, control the buttons that appear, and capture user interactions with the buttons. That’s not a hint by the way
But as you say, Processing was never designed as a full blown language to handle this sort of thing.
I feel like Processing is such an odd duck. While in some ways it is incredibly robust and powerful, in other ways it so misses the mark on basic needs for creating robust apps (which was NOT the design goal, I know!).
But then why all the advanced features too? Again, it’s so odd. But so cool too.
In any case, as always, many thanks for your insights. If you have any other thoughts I’d love to hear them, but I value your time, and you’ve already been so generous. So that’s me saying “THANKS AGAIN!!!”