eugene.chepurnykh's picture

Not firing Load event for GLControl.

Project:The Open Toolkit library
Category:bug report

GLControl.Load fire never.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


Version:all versions» 0.9.9-1
Status:open» confirmed
the Fiddler's picture


Version:0.9.9-1» 0.9.8-2

Confirmed to occur on earlier version.

objarni's picture


Workaround: Use Form.Load event instead. In practice this has worked since OpenTK 0.3.13, and it seems to work with too.

the Fiddler's picture


Status:confirmed» in progress

Ok, the reason is that the GLControl.Load event is raised as soon as you call its constructor, not giving you a chance to hook it.

The solution is to modify the GLControl to be constructed lazily, as all regular controls do.

the Fiddler's picture


Version:0.9.8-2» 0.9.x-dev
Status:in progress» fixed

Issue fixed in trunk (rev. 2203).

Please test if it works as expected on Windows, as I do not have access to a Windows installation right now.

objarni's picture


@Fiddler cool!

@Hex - if you read this - could you please try this out since you are "close to the issue"? :) [assuming you are on Windows that is..]

the Fiddler's picture


Version:0.9.x-dev» 0.9.9-2b
Status:fixed» closed

Closing issues fixed in 0.9.9-2.

FauxBestaan's picture


Status:closed» open

Still not fixed on Windows in 0.9.9-2b. Having to use Form.Load instead.

the Fiddler's picture


Status:open» fixed

Confirmed, debugged and fixed in SVN rev. 2281.

The issue was that the winforms designer sets all public properties by default. In this case, it specified VSync = false, which caused the control to be realized prematurely - before you got a chance to connect any events. This issue would always manifest in the VS designer but not when you created the control through code - which explains why it passed through unnoticed.

Can you please verify that it works as expected now?

FauxBestaan's picture


Working as expected. Good job :)