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

**URL:** <https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235>\
**Category:** General\
**Created:** [September 26, 2013, 11:20pm UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235 "2013-09-26T23:20:22Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Astrahan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@Joe\_Astrahan](https://forum.xojo.com/u/Joe_Astrahan)\
**Post date:** [September 26, 2013, 11:20pm UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/1 "2013-09-26T23:20:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [September 26, 2013, 11:59pm UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/2 "2013-09-26T23:59:58Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [September 27, 2013, 12:26am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/3 "2013-09-27T00:26:21Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [September 27, 2013, 12:35am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/4 "2013-09-27T00:35:51Z")

</div>

> [@36807:@Michael Diehr](#):
>
> we’ve also been told “don’t count on control event order” at various times as well.

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.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [September 27, 2013, 12:47am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/5 "2013-09-27T00:47:40Z")

</div>

[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 🙂

---

<div class="post-metadata">

**Author:** ![Joe\_Astrahan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@Joe\_Astrahan](https://forum.xojo.com/u/Joe_Astrahan)\
**Post date:** [September 27, 2013, 1:42am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/6 "2013-09-27T01:42:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [September 27, 2013, 2:13am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/7 "2013-09-27T02:13:52Z")

</div>

Hi Joe,

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

---

<div class="post-metadata">

**Author:** ![Joe\_Astrahan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@Joe\_Astrahan](https://forum.xojo.com/u/Joe_Astrahan)\
**Post date:** [September 27, 2013, 2:15am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/8 "2013-09-27T02:15:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Joe\_Astrahan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@Joe\_Astrahan](https://forum.xojo.com/u/Joe_Astrahan)\
**Post date:** [September 27, 2013, 2:17am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/9 "2013-09-27T02:17:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [September 27, 2013, 3:16am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/10 "2013-09-27T03:16:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Joe\_Astrahan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@Joe\_Astrahan](https://forum.xojo.com/u/Joe_Astrahan)\
**Post date:** [September 27, 2013, 4:42am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/11 "2013-09-27T04:42:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Joe\_Ranieri](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@Joe\_Ranieri](https://forum.xojo.com/u/Joe_Ranieri)\
**Post date:** [September 27, 2013, 4:51am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/12 "2013-09-27T04:51:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [September 27, 2013, 7:11am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/13 "2013-09-27T07:11:53Z")

</div>

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

\<[https://xojo.com/issue/27719](https://xojo.com/issue/27719)\>

---

<div class="post-metadata">

**Author:** ![Joe\_Astrahan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9e8a1a/32.png) [@Joe\_Astrahan](https://forum.xojo.com/u/Joe_Astrahan)\
**Post date:** [September 28, 2013, 7:33am UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/14 "2013-09-28T07:33:58Z")

</div>

Oh okay, good to know.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 4:52pm UTC](https://forum.xojo.com/t/openglsurface-resized-event-runs-before-open-is-this-a-bug/11235/15 "2020-10-29T16:52:10Z")

</div>


