Varsuuk
September 9th, 2019, 05:18
I saw some of my code duplicated, what I thought was sloppy until after I moved it I saw odd behavior.
I realized it was because I had the same cleanup code duplicated at the end the "handler" method for attemptToMultiClass and attemptToDualClass methods instead of where I would logically put it after it checks if first class, multi or dual then falls through to the cleanup.
This does not work because I call "Interface.openwindow()" to present the user with a "are you sure" option (but it may be more than that in future, so don't assume a yes/no is sufficient for the popup) and the code falls through to the cleanup before the new window is closed and therefore the settings made in the window haven't yet been made.
I got around this by making sure I did nothing after the openWindow calls and handled all "post window" code in the window handlers. No problems. Just wondered if I missed a way to call a window "modally" where it interrupts all until you clicked a choice and returns to caller?
I realized it was because I had the same cleanup code duplicated at the end the "handler" method for attemptToMultiClass and attemptToDualClass methods instead of where I would logically put it after it checks if first class, multi or dual then falls through to the cleanup.
This does not work because I call "Interface.openwindow()" to present the user with a "are you sure" option (but it may be more than that in future, so don't assume a yes/no is sufficient for the popup) and the code falls through to the cleanup before the new window is closed and therefore the settings made in the window haven't yet been made.
I got around this by making sure I did nothing after the openWindow calls and handled all "post window" code in the window handlers. No problems. Just wondered if I missed a way to call a window "modally" where it interrupts all until you clicked a choice and returns to caller?