Have a Wetpaint account? Sign in
Script Test 1
This sample shows the use of both class and instance level scripts. The scripts change the display name of the object they are implemented on. In order to script at this class leve, this sample has a custom type under Types, named "My Sphere".
This type inherits from a regular Sphere, the difference is a single even script. The script is for the OnStartUChanged event. The script is as follows:
string val = context.Site.GetValueAsString(startUProperty);
context.Site.DisplayName = val;
This script gets the startU property value as a string, from the instance. It then sets this as the property grid display name for the instance.

IObject radiusProperty = context.Site.GetPropertyByName("Radius");
string val = context.Site.GetValueAsString(radiusProperty);
context.Site.DisplayName = val;
This script is almost the same as the class level script, except this instance script uses the radius value as its display name.
Try changing the Radius and StartU properties on the two spheres. The sample has two GUI sliders for this. The first slider modifies the first MySphere radius to activate the OnRadiusChanged event script. The second slider changes the second MySphere StartU to activate the class level OnStartUChanged event script.
|
X-Tatic |
Latest page update: made by X-Tatic
, Jun 3 2007, 9:13 AM EDT
(about this update
About This Update
view changes - complete history) |
|
Keyword tags:
None
More Info: links to this page
|
There are no threads for this page.
Be the first to start a new thread.


