
Not firing Load event for GLControl.
Posted Tuesday, 4 August, 2009 - 11:59 by eugene.chepurnykh| Project: | The Open Toolkit library |
| Version: | 1.0-beta-1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
GLControl.Load fire never.


Comments
#1
#2
Confirmed to occur on earlier version.
#3
Workaround: Use Form.Load event instead. In practice this has worked since OpenTK 0.3.13, and it seems to work with 0.9.9.1 too.
#4
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.
#5
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.
#6
@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..]
#7
Closing issues fixed in 0.9.9-2.
#8
Still not fixed on Windows in 0.9.9-2b. Having to use Form.Load instead.
#9
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?
#10
Working as expected. Good job :)
#11
Thanks for testing, will try to make a bugfix release next week.
#12
Closing issues fixed in 0.9.9-3.
#13
I am still not getting the glControl Load event firing with 0.9.9-3 VS C# 8.0. Here is my code:
#14
Fixed in rev. 2371, can you please test if the fix works?
The previous fix (rev. 2281) caused the control to be prematurely initialized when the Size property was set. The VS designer always sets this property before hooking any events, which meant these events were never raised.
I've added a different workaround, which simply suppresses the Resize event until the control has been correctly initialized. This seems to work correctly here, but need confirmation.
#15
Downloaded the latest dated 10/21/2009... and the Load event still does not fire for me... will attach my two files... thanks.
#16
You have two Load events:
#17
Even when I connect the Form1_Load event (which does fire), I don't get the glControl1_Load firing... I wonder why...
#18
I should have clarified, the glControl1_Load event works correctly in trunk (SVN revision 2371 or higher). It is broken in the 0.9.9-3 release.
SVN instructions here. If you don't wish to build from source, you can wait for 0.9.9-4 which will come early next week.
#19
I'm using 0.9.9-3 and also not seeing the Load event fire, but ONLY when using a non-standard DPI in the operating system. This has been confirmed on separate machines under both Win XP and Vista. The Load event will fire correctly when using the default 96 DPI, but not when using 120 DPI. I don't know if the DPI factor is complicit to the issue itself or just changes timing enough to change the sequence of events, but it does seem very predictable.
I will try this out on 0.9.9-4 when available. For now I am working around it by doing the initialization I want on Load during the first Resize event if Load never fired.
#20
Thanks for testing, can you please file a new bug report for this issue? I wish to clear all GLControl issues before the 1.0 release and this might get lost here.
#21
Closing issues fixed in 1.0 beta-1.