Unable to stop a window showing before ready

I’ve spent so long trying to stop flicker and drawing actions being visible in Windows.

I stupidly imagined that setting a window to be visible = false
then arranging things
then making it visible

would be enough.
But when I open the document window, I always get a window opening animation, with a few half drawn controls on it.
Then it goes invisible (even though set to visible = false in the IDE)
Then my arrangement code runs
Then the window is made visible
Then Activate fires

How do I stop the window from appearing in this half baked format before I am ready?
Windows 11, Xojo 2018 for this project

1 Like

I too am interested in the solution.

I have the same issue, but in regards positioning the window and changing the Toolbar to be inside the menu. I have not found any workaround so far. It is a problem on macOS too.

How do you show the window? Using Window.Show?
Also, is Implicit Instance turned on?

Half the problem is that Open() simply doesn’t fire when I create the new window.
It’s straight into activate or other events.

Its always x as new mywindow

No amount of .visible = false
or WM_SETREDRAW calls stops it from just leaping into existence as a mostly grey window, then drawing.

Can’t you open it offscreen ?
Then move it where you need it once all initialization are done…

you mean

var x as new mywindow

in this case you can do something
var x as new mywindow

and some flicker can happen with container controls, if so check all theirs properties
and special options.

No container controls.
I cannot set Left or Top properties in the IDE.
By the time I can set the position, it has already been displayed badly.

Open() doesn’t fire. (checked with a debug log since breakpoints didn’t work)

The window is a subclass
In the contructor of the parent, I set the color and position of some controls if it is windows.
The constructor is called once only no matter how many windows I open.

Those things may be not relevant, but it all feels very flaky.
I’ve mostly ignored it (or tried to work around it) for years, but I’m having an intolerant week.

What Xojo version? As currently Event Open does not exist anymore, could it be a side effect?

As currently Event Open does not exist anymore,

Xojo 2018
I am using API1 only, and the window is a ‘Window’ not a ‘DesktopWindow’

Open() failing has been a problem for me since well before 2015

I commonly add a call to initialisation code into both Open and Activate events with a flag to ensure it runs only once no matter which of these occurs first, or whether only one of them executes)

Well… Currently it works. I tested it (Event Opening). I skipped the entire 2017 and 2018 generations due to lots of problems related to 64bit and DirectX

I think Xojo 2018 suffers from post Direct2D transition issues. Have you tried a newer version?

Amusingly, this IS me trying a newer version.
I can mostly rely on Xojo 2015… anything after that wasn’t drawing stuff properly and was too slow.
(The work I have put in just in the last week to get 2018 to work is the closest I have got to a build I could consider shipping for a very long time)

This is Xojo 2021:

(The message appears to relate to C+ DLLs but this is a recent Windows 11, and I have both run the installer and placed copies of the DLLs local to the EXE)

If you post a demo project of it happening I’ll see what I can do to help.

1 Like

Its a huge project relying on MBS plugins … If I can make a cut down project that runs, I will .

We have the same problem but use Xojo 2014r2.1 for MS-Windows builds.

1 Like

I hope that’s

Dim x as new mywindow

Also, make sure the implicit instance property is also set to false in the inspector.

1 Like

Greg, do you share my opinion that the ImplicitInstance feature should be thrown into a volcano? It has been an endless source of confusion for years and tends to send new users down the wrong path - nothing else in the language self-instantiates and I feel that it sets up the incorrect expectations as to how objects work.

I would agree with that too. It was a sop to VB users but has caused many a query here over the years.
Its nothing to do with this, however

It is