There is an example in the programming help. You can view it as follows: 1. Open the programming help by selecting Help: Programming from the dialog. 2. Go to the Create X-Function page (>Programming > X function > X Function Programming Guide > Create X-Function > Creating dialog) 3. Click Example above Adding Custom Button Or Apply/Undo Button.
We are trying to improve documentation on X-Function programming. We hop that you will see better documents in SR1.