This chapter describes properties and events in SilverStream, including:
You use properties and events to define the features and behaviors of objects you develop in the SilverStream Designers. They are part of the visual-programming toolset that SilverStream provides and their purpose is to give you a productive, consistent way to manipulate more complex and varied implementation details.
Properties and events are separate from the SilverStream API. The properties and events you specify for a particular Designer object turn into metadata that tells SilverStream how to generate and operate that object. Often this results in method calls to a corresponding class in the SilverStream API, but not always.
Properties are attributes that you set at design time for a particular Designer object, such as a form or page. You specify them in the Designer's Property Inspector dialog. For instance, here are the properties for a label control on a page:
Overriding properties at runtime
Because properties are not part of the SilverStream API, you can't access them directly at runtime like instance variables (fields). But for many properties, the API does provide accessor (get and set) methods that enable you to read and modify those property values.
Example
In the previous illustration, the Enable HTML Generation property is checked at design time to specify that you want the HTML for the lblSamples control generated on the page. But suppose you need to do a runtime test (maybe based on user authority) and dynamically turn off HTML generation of that label.
If you look at the API methods for the corresponding SilverStream class (AgpLabel), you'll find you can code:
getEnableHTMLGeneration()
to find out whether HTML generation is currently enabledsetEnableHTMLGeneration()
to turn HTML generation on or off
Events correspond to event-handler methods that the Designers provide for forms, pages, and other objects. To perform the processing you want for a particular object, you use the Programming Editor to write code in its appropriate event-handler methods. For instance, here are the events for a button control on a form:
Notice that the actionPerformed event for the Save button corresponds to the event-handler method handle_Save_actionPerformed()
. The code you write here will execute when a user clicks that button.
Under the covers
Events are implemented in a couple of ways:
pageGenerateBegin()
for a page (the AgpPage class).actionPerformed()
method of the ActionListener interface. Earlier you saw an example of the actionPerformed event, yet the method involved was not actionPerformed()
but handle_Save_actionPerformed()
. That's because SilverStream automatically generates actionPerformed()
and dispatches calls to methods named handle_
ControlName
_actionPerformed()
.
You can use the SilverStream help system to get reference information about the properties and events for:
Here's how to find that information:
Want a list of the properties and events associated with a particular class in the SilverStream API | The documentation for that class in the SilverStream API help |
Want a list of the properties and events for a particular Designer object (such as a form, page, or control) | This chapter in the General Reference: Designer Objects and their API Classes
|