The Code Writer wizard (written in PiXCL, source provides in the sample code) generates a running skeleton application. Here's the code produced.
This code produces this window.

Copyright © 2005-2012 PiXCL Automation Technologies. All Rights Reserved.