OpenGLSurface (Resized) Event Runs Before Open? Is this a bug?

Create any OpenGLSurface, put a msgbox in the resized event and a message in the open event. The resize will trigger it’s msgbox first? Why is this the case?

Also the window the surface is in, it’s open event will trigger next. So do children elements always have there ‘open’ events triggered first?

This is important because I need to reliably initialize variables before the resize commands can be allowed to be run.

Note: I have the openGLSurface set to lock to the sides of the window so as it resizes it will also.

I’ve seen things like that, and have taken to coding defensively:

Control.Open
  mOpened = true

Control.Resized
  if not mOpened then return

I think it’s pretty arguable that Resized before Opened is a bug, though I think we’ve also been told “don’t count on control event order” at various times as well.

Put those lines in the proper places in the events instead of a msgbox, and check if the order is consistent in the message pane:

system.Log system.LogLevelDebug, "Open "+str(Microseconds)

system.Log system.LogLevelDebug, “Resize”+str(Microseconds)

In my Xojo 101, I was told that the event.open() always come after the constructor(), than the rest, so, if a resize() occurs before an open(), for me it should be a bug.

[quote=36808:@Rick A.]Put those lines in the proper places in the events instead of a msgbox, and check if the order is consistent in the message pane:

system.Log system.LogLevelDebug, "Open "+str(Microseconds)

system.Log system.LogLevelDebug, “Resize”+str(Microseconds)[/quote]

Or system.debuglog CurrentMethodName + " " + str(Microseconds) in both :slight_smile:

Okay I’m glad some people agree this is a bug, I thought I was going crazy. I noticed in objective-c coding that I also do on the side with xCode, this same error occurs where resize events run before the open events on the nib files which leads me to believe this may be a mac error?

I have not tested to see if this happens also on the windows side? does it anyone?

Hi Joe,

Yes, the same thing happens on Windows 8: Xojo 2013 R3, the resized event fires before the open event :slight_smile:

7:12:28 PM
My Application Launched
7:12:29 PM
mainWindow.GameOpenGLSurface.Resized 1.990810e+12
mainWindow.GameOpenGLSurface.Open 1.990812e+12

You can see the resized event runs first.

If we all agree this is a bug, how do you create a bug report for it?

If it happens in obj-c, too, then it may not classify so much as “bug”, but as “gotcha that you need to be aware of and code for”. If your code depends on open occuring before resize, then use a flag/flags to inform you.

Thats very possible, that is what I’m doing, but a user did say that it happens on the windows side also. So I’m not sure anymore.

Please file a Feedback report about this – it’s definitely a bug.

I’ve noticed a feedback case for this issue already exists, and is already tagged as verified.

<https://xojo.com/issue/27719>

Oh okay, good to know.