I'm at the airport waiting for my second delayed flight, but that means I have had some time. 
Ok, so this should work with any version of FuseGL, and this is the power of FuseGL.
So make a *.cs file called "CustomGooCode.cs" and place it in the *.exe's directory. Put the following code into that file.
Code:
using System;
using System.Collections.Generic;
using FB_USB_2011;
using FuseGL.GUI.Text;
using FuseGL.Logic;
namespace CustomGoo_Namespace
{
class YourCustomGooParentClassName
{
private int some_global_to_you_variable_maybe = 0;
public object returnSomethingMethod()
{
return some_global_to_you_variable_maybe++;
}
public void DigitalOutputPort___IncreaseValue(FB_Monitor.DigitalOutputPort _port)
{
_port.Value++;
}
}
}
Now in your UserGUIConfig.xml file, put this as one of your button's events:
Code:
<events>
<onMouseDown action="FuseGL.ExecuteCode" inputArgs="CustomGooCode.cs;CustomGoo_Namespace.YourCustomGooParentClassName;DigitalOutputPort___IncreaseValue;{FB.DigitalOutput(0.10)};"/>
</events>
And that's it.
So when you click the button it does the "FuseGL.ExecuteCode" action. This is the main power beef of FuseGL. It will compile your code on the fly, integrate it into the program as a binary and that external code is hooked into everything available in FuseGL from the mouse cursor to raw pixels or all the input/output ports, all events, and even the debug log. Everything...
So once it knows it is doing that, it looks for the code as a file which we told it is "CustomGooCode.cs". You could make that anything (relative or absolute) and it will work. So "C:\Pants.cs" will work if you named the code file "Pants.cs" and put it on your C: drive. If it does not find the file, it checks an internal cache of code files to see if it is in there (which it won't be so it would then fail).
It then looks for and compiles the class "YourCustomGooParentClassName" which it looks for in "CustomGoo_Namespace". Again you can probably relate those names to the *.cs file earlier and change them at your whim.
If everything compiles and hooks in correctly, then it invokes the "DigitalOutputPort___IncreaseValue" method. It passes it in parameters of "FB.DigitalOutput(0.10)". All parameters are in the format of: "{parameter};{parameter2};{parameter3};" if there was a return object, it would go in the outputTo="somewhere" part of the XML file.
And that function it calls just increments the "Value" of the digital output port you pass in by one each time you click it.
Bookmarks