Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
beansdoc [2011/01/05 10:28] – More basic beans hourdin | beansdoc [2012/02/07 18:05] (current) – removed Stéphane Lavirotte | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Using WComp beans ====== | ||
- | This documentation page presents the most usual ways of creating applications and converting event types using basic beans. Events are noted **^eventName** and methods are noted **methodName(**// | ||
- | |||
- | ===== Windows forms (graphical widgets) ===== | ||
- | |||
- | Windows forms only provide events with no argument (void). A textbox does not directly provide a string event for example. Below is a list of mostly used widgets and events. | ||
- | |||
- | ==== Button ==== | ||
- | * **^Click**: emitted when the button is clicked. Generally used to trigger void methods on other beans, like starting threads or triggering the sending of one argument events in the [[beansdoc# | ||
- | |||
- | ==== CheckBox ==== | ||
- | * **^CheckedChanged**: | ||
- | * **set_Checked(**// | ||
- | |||
- | ==== Label ==== | ||
- | Labels are generally only used to display information, | ||
- | * **set_Text(**// | ||
- | |||
- | ==== TextBox ==== | ||
- | * **^TextChanged**: | ||
- | * **^Leave**: emitted when the focus is lost by the textbox, i.e. when the mouse is clicked outside the textbox. This event can be used to mark the end of the text edition in the textbox. It has the advantage of being sent only once, contrary to the ^TextChanged event which is sent on each character change. The string information of the text is provided by the **get_Text()** property getter. | ||
- | |||
- | ===== Beans of the Basic Category ===== | ||
- | |||
- | ==== BooleanFactory ==== | ||
- | This bean allows to generate boolean events from void events, quite similar to the [[beansdoc# | ||
- | * **set_TrueEvent()**: | ||
- | * **set_FalseEvent()**: | ||
- | A simple method is then used to trigger the boolean event: | ||
- | * **FireBool()**: | ||
- | * **^BooleanCreated**: | ||
- | |||
- | ==== BoolFilter ==== | ||
- | This bean is used to propagate a boolean event only when its value is either //true// or //false//, but not both. The filtered value of the boolean event can be parametrized by the **Filter** property of the bean. When the received event value matches the Filter property value, the BoolFilter can send two events, a void and an integer event: | ||
- | * **^EventFiltered**: | ||
- | * **^IntValEmitted**: | ||
- | * **SetLevel(**// | ||
- | |||
- | ==== Counter ==== | ||
- | |||
- | ==== EventFilter ==== | ||
- | The EventFilter bean acts as an electric relay on a flow of //void// events. It has a boolean property indicating if it is closed or open, and an input method relayed to an output event. | ||
- | * **FireEvent()**: | ||
- | * **^EventOut**: | ||
- | * **set_Propagate(**// | ||
- | |||
- | ==== EventToggler ==== | ||
- | This bean allows to create alternating event calls from a single event stream. It receives a //void// event and sends alternatively the **^EventOut0** and **^EventOut1** //void// events. It also sends a boolean event alternating between //true// and //false// values. | ||
- | * **FireEvent()**: | ||
- | * **^EventOut**: | ||
- | |||
- | ==== PrimitiveValueEmitter ==== | ||
- | The PrimitiveValueEmitter is probably the most useful bean, since it can convert a void event to any primitive type of events, like //string//, // | ||
- | * **FireValueEvent()**: | ||
- | * **^Emit// | ||
- | * **set_// | ||
- | |||
- | ==== Threshold ==== | ||
- | |||
- | ==== ValueFormatter ==== | ||
- | This bean allows to convert a primitive type event to a string. This is nearly the opposite of the [[beansdoc# | ||
- | * **Format(**// | ||
- | * **^StringValueChanged**: | ||
- | More than allowing to convert primitive types to a string, the ValueFormatter allows to modify the format of the output string, for example to add the unit of an integer value. The **ValueFormat** property of the bean allows to change the output format of the string. The format of the ValueFormat property is the standard C# formatting syntax [[http:// | ||
- | |||
- | Example: a "{0} ms" ValueFormat value will emit a "12 ms" string for a Format(12) method invocation. |