Where is desktopWindow.implicitInstance

Has this property been removed from the IDE - I can’t see it any more.

It is there if I change to a Window, but not for a desktopWindow.

Inspector Behaviour… says its there - but not on my IDE.

Senior moment?

Moved to:
image

Thank you.

“Windows Behavior”? This implies (no pun intended) that it’s something specific to the Windows operating system. Should be “Window Behavior”.

9 Likes

Wthat a good question it is !

Yes, but not yours… :wink:

1 Like

Ug…Window Implicit Instance is such the source of confusion and subtle bugs in code that I wish they hadn’t move it to this new obscure location. I can’t tell you how many times I fixed client code where they left implicit instance on when they shouldn’t have. I don’t recall if I ever penned an “ImplicitInstance is Evil” blog post or not but I should have.

But I agree, the Label indicates that it’s for Windows, as in the OS, rather than for any window any OS.

3 Likes

Apparently I did write a blog post about it. An archive is at https://bkeeney124.rssing.com/chan-63470789/all_p1.html titled “ImplicitInstance is Evil”. :slight_smile:

3 Likes

While I agree that Implicit Instance can be confusing and lead to a lot of potential bugs, we wrote an entire ERP system that takes advantage of Implicit Instance and the fact that there is ever only one instance of a given window. So, yes, it can be confusing and lead to issues, but if you go in with your eyes open and understand the implications, it can be very useful.

Yeah, don’t get me wrong, I use Implicit Instance myself for certain types of windows. I’ve just fixed so many client projects that were using it incorrectly that I think it’s a subtle bug that can be maddening to figure out. Newbies get bit by it a lot because they don’t understand the implications.

Yes, so we protect the newbies by hiding it in an “Advanced” pane where they’ll never figure it out. :woman_facepalming:

4 Likes

…with a typo from which one might infer that it’s a Windows feature. :slight_smile:

1 Like

It looks like a future release of Xojo will have this fixed: #70250

1 Like

I wish implicit instance didn’t exist. It’s pretty easy to introduce your own if that’s something you need, and if I recall correctly, if it didn’t exist we could put windows in modules.

Thanks to Norm Palardy for this link, showing how to override Xojo defaults:

https://documentation.xojo.com/topics/advanced_features/setting_default_values_for_xojo_framework_class_properties.html#setting-default-values-for-xojo-framework-class-properties

With this guidance, you can create a file called Window.defaults (or DesktopWindow.defaults–or one of each) that contains the line

ImplicitInstance=false

As stated in the doc, using the Mac path here, stick the file(s) in ~/Documents/Xojo/Overrides, then restart Xojo.

This works great for me. It’s rare that I want an implicit instance. In my own apps such will only be a main window that is always open (I’ll even quit in its Close event.) With the default now being false, gone are the days when I have to remember to turn it off when adding a new window to the project–and sometimes forget.

Thanks again, Norm :slight_smile:

1 Like

I tried to get the overrides (implicitInstance) in Linux working. First I put them under ~/Documents/Xojo/Overrides (thats the folder which is stated in the documentation), that changed nothing. Then I found a prepared folder under ~/.Xojo/Xojo/Xojo 2022r2/Overrides/ but that also didn’t work. The overrides work under Windows with the same settings.

Can somebody confirm that the override-Feature is working under Linux (using 2022 R2).

Edit: Well, placed the files another time in ~/Documents/Xojo/Overrides an now it works.