Where is the documentation for the FrontPanel scripting?


I’m trying to write a simple LUA script and can’t find the correct documentation. Under section 7 of the FrontPanel Scripting section of the SDK user manual it says

" This section contains reference documentation for the Lua API exposed by FrontPanel, i.e. classes, functions and constants that can be used from the scripting functions. All of them are defined in OpalKellyUI module, …"

It then goes on to list some methods, like findLED() and findGauge(), but it leaves out a lot of others. Where can I find this OpalKellyUI module and see all the methods available for each XML component?

Thank you.

The methods available for each component are documented on each components page, for example the okStaticText. Is this the documentation you are looking for? We will try to clarify this in FrontPanel scripting overview page.

Well, there seem to be a lot missing, but that ‘is’ what I’m looking for. I.e., the PipeTest.lua file has something called FindCombobox(). That isn’t listed anywhere in the documentation, that I could find. There are several other methods called there that i couldnt find any reference to.

All I want to do is have two Triggerbuttons, button A, and button B. Only one can be ‘active’ at any one time, so I want the pressing of one to toggle the value of the other, if the other is ‘active’.

Is there just a simple way to list all available methods for an object in the Debug Log, or is there a file that has the OpalKellyUI module definitions?

For example if I have a ToggleButton named “DACA” and I try the following line


The Debug log says

<userdata of type ‘wxControl *’ at 0000002084C5DD1E0> (nil) = nil

Which is the overall object, but is there a way to print out the methods accessible by that object? In case the documentation misses them?

Apologies for missing the FindCombobox() method, that is a mistake on our part. We will add that to the documentation soon.

It should be possible to list all of the methods for an object in Lua using a method like the one described here. We will pass this on to our software team to work out exact instructions and let you know if it works.

Hi, thanks. I had tried that approach earlier and it doesn’t seem to work. Maybe it needs a slight tweak.

The function is now

    function DACAtoggle(event)
	       for key,value in pairs(DebugLogValue(okUI:FindPanel("panel1"):FindControl("DACA"))) do
	       DebugLogValue("found member " .. key);

which gives the error (not a debug log)

          bad arument #1 to 'pairs' (table expected, got no value)

Well I think I made some progress. The toggleButtons are wxWidgets, and according to the documentation at


they should have methods GetValue and SetValue. Located at the bottom of the page.

Unfortunately when I run the following function

 function DACAtoggle(button, event)
	local DACBbutton = okUI:FindPanel("panel1"):FindControl("DACB")

It throws the error:

Running function DACAtoggle() failed: run-time error. Attempt to call a nil value (method ‘GetValue’))

Unfortunately after investigating this further it looks as though it is not possible to get Lua to output each of the functions we provide in a simple manner. This is due to the way the Lua->C++ interfacing works as the underlying API is provided by our C++ API.

We will work to improve the documentation for these components soon, including a listing of the functions available for each component object.

In the example you have sent, can you supply a portion of the XML including the DACA and DACB buttons to get an idea of how that is set up?

Hi Tom,

Thank you for replying.

So, what we were trying to do was make two buttons, but only have any one button active at any one time. Selecting one would not only turn it on, but also turn off the other button (if it was on). We ran into trouble here because while there is a GetValue() method, there is no SetValue() method for the buttons. So to solve this we just tied a okLED to each button, and because the LEDs have GetLEDState and SetLEDSTate, we could do what we wanted. The LUA functions were very simple, and were something like the code below. I am more than happy to provide the entire code if you want it, but it’s a bit long to copy / paste.

function led6On()	

function led7On()

If I were to make a suggestion it would be to make all the wxWidget methods available for each OK component, if that’s possible. I.e., the wxToggleButton has both GetValue() and SetValue() methods, but the okToggleButton, which according to the debug log is based off of the wxToggleButton, only has GetValue(). There are lots of other missing methods for combobox, and probably a few others. If there’s any way to access these methods, or add them in, that would add a lot of functionality that seems to be already built in to the underlying code.

I’ve linked the wxToggleButton page for reference.


It may be possible to export the wxWidgets methods directly, but this can also introduce significantly more complexity and room for errors and bugs. Generally speaking if a design requires this level of integration it makes sense to build an application using the FrontPanel API rather than trying to stitching something together with XFP files.

Ok, that makes sense. Thank you.

We are just getting started with our FPGA so we went with the XFP and LUA file approach because it seemed easier. We will look at the API approach next. Thanks again!