Hello YuChing,
actually you create only a new instance of the class WidgetSet::PushButton. Thereupon you need two additional steps:
Step 2. Configure the button.
In particular you should set the property Appearance of the just created button instance to refer to one of available PushButtonConfig objects. Otherwise the button will not have any information how to appear. You will see nothing.
Step 3. Add the button instance to an existing GUI component.
In order to be visible on the screen, every view (thus also a button) has to belong to the view tree. This can be controlled by using the methods Add() and Remove() of the GUI component in context of which you want the button to be added or later removed again. Please see the section: Compose the component programmatically.
Accoringly the correct code to create and show a button would be:
// Step 1: Create a new instance of the button
var WidgetSet::PushButton btn = new WidgetSet::PushButton;
// Step 2: Configure the button instance
btn.Appearance = WidgetSet::PushButton_Medium;
btn.Label = "Hello World!";
// Step 3: Add it to the view tree. Assuming this code is executed in
// context of an already visible GUI component
Add( btn, 0 );
// ... or if you want the button to be added to 'other' component
otherComponent.Add( btn, 0 );
I hope it helps you further.
Best regards
Paul Banach