Hi JR,
Tricky, you are right. We can see that it occurs on 5 lines where events are set. SmallBasicCallback is a delegate to a function (basically a variable that is actually a function). m_onmenu is a variable (Primitive) and onmenu is the function we actually want. Why it has called it m_onmenu is odd, but you can see in your original SB code you have used the same name OnMenu for the event subroutine AND a variable.
The fix is probably use separate variable for variable and subroutine name in SB, or in the C# change to use the delegate function name (without the m_).
So, it does make sense!
If I didn't spot this, my next step would be to test a very simple SB event program and see what it looked like decompiled:
Tricky, you are right. We can see that it occurs on 5 lines where events are set. SmallBasicCallback is a delegate to a function (basically a variable that is actually a function). m_onmenu is a variable (Primitive) and onmenu is the function we actually want. Why it has called it m_onmenu is odd, but you can see in your original SB code you have used the same name OnMenu for the event subroutine AND a variable.
Code:
'Events Enabled
LDControls.MenuClicked = OnMenu
LDShapes.ShapeEvent=OnShapeEvent
GraphicsWindow.KeyDown=OnKeyDown
Controls.ButtonClicked=OnButtonClicked
LDShapes.SetShapeEvent(tb[0])
Controls.Texttyped=OnTextTyped
While "True"
If OnMenu = "True" Then
...
Sub OnMenu 'Setup Menu
OnMenu="True"
EndSub
The fix is probably use separate variable for variable and subroutine name in SB, or in the C# change to use the delegate function name (without the m_).
Code:
LDControls.MenuClicked += _SmallBasicProgram.onmenu;
LDShapes.ShapeEvent += _SmallBasicProgram.onshapeevent;
GraphicsWindow.KeyDown += _SmallBasicProgram.onkeydown;
Controls.ButtonClicked += _SmallBasicProgram.onbuttonclicked;
LDShapes.SetShapeEvent(Primitive.GetArrayValue(tb, 0.0));
Controls.TextTyped += _SmallBasicProgram.ontexttyped;
So, it does make sense!
If I didn't spot this, my next step would be to test a very simple SB event program and see what it looked like decompiled:
Code:
GraphicsWindow.MouseDown = OnMouseDown
Sub OnMouseDown
EndSub