Showmodal is different now?

Windows, desktop here. In the older days, for example, to show a modal window named help4 in the current window, I could use: help4.showmodal and it worked fine. Now that doesn’t work anymore (2024r2), I get errors.

Yes, the documentation isn’t much help. How would I do this now? The window (help4) is set as a modal dialog already. With API 2, did this change?

What errors?

“Static reference to instance method: call this on an instance of class Window”

Maybe your help4 ‘Implicit Instance’ is Off?

Nope, checked that. I did notice it was set as API 2 (the ‘DesktopWindow’ thing). Did the functionality of showmodal change in API 2? I looked in the Docs, no notes about a change.

Your error mention class Window and not class DesktopWindow.

Can you share a sample app?

The only way I can think of reproducing your error is changing the instance to Off.

image

Odd. The backdrop and window name were the same. I changed the name of the backdrop to something different and now it works. Hm.

Did you name your backdrop help4? That might confuse the compiler if you had an image loaded into the project with the same name as the window class.

It shouldn’t. If it does, there’s a bug.

“confuse the compiler” in the sense that you can’t have two project items named the same thing, hence producing the error he showed. I wouldn’t consider that a bug.

1 Like

I did name my backdrop help4 and the window help4. Changing the backdrop graphic to help41 after deleting the old backdrop fixed it. I did notice the help4 window was named to the API 2 thing of DesktopWindow, and I changed it back to Window, if that matters. The other 2 help windows, help1 and help2, didn’t have this backdrop conflict and they both work fine.

In the OP, he said it compiled and run in the past and now it fires an error. I said the same as you said above, clashing names should not compile and errors pointed for fixing.

Hmmm, and I thought it was only me and my dodgy code. I recently upgraded to 2024r2 and my Showmodal calls all stopped working with the same error you have. but if i created a new project and used Showmodal it worked fine.

I can’t work out why it does it. The only 100% reproducible scenario in my project is that I have graph controls on the modal window. If i add a dataset to a graph that turns out to be empty then showmodal fails.

I just put in extra checks in my code to prevent an empty dataset, and assumed i was using Showmodal wrong.