beansdoc

This is an old revision of the document!


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(argument types).

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.

  • ^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 PrimitiveValueEmitter bean.
  • ^CheckedChanged: emitted when the state of the checkbox is changed (checked or unchecked). The boolean information of this status is provided by the get_Checked() property getter.
  • set_Checked(boolean): method allowing to change the checked state of the checkbox.

Labels are generally only used to display information, not as a source of event.

  • set_Text(string): method allowing to change the text inside the label.
  • ^TextChanged: emitted when the text changes in the textbox, at each change, so when text is typed in the textbox, each character change will result in a new event. The string information of the text is provided by the get_Text() property getter.
  • ^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.

This bean allows to generate boolean events from void events, quite similar to the PrimitiveValueEmitter, but more simply. The default value of the output boolean is false, and this value can be changed either using the State property and thus the set_State(boolean) method, or using the two following void methods:

  • set_TrueEvent(): changes the emitted boolean value to true.
  • set_FalseEvent(): changes the emitted boolean value to false.

A simple method is then used to trigger the boolean event:

  • FireBool(): method triggering the sending of the boolean event.
  • ^BooleanCreated: the boolean event emitted by the BooleanFactory bean.

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: the void event sent by the bean when the incoming event matches the property value.
  • ^IntValEmitted: the integer event sent by the bean when the incoming event matches the property value. The value of the integer is parametrized by the SendValue bean property.
  • SetLevel(boolean): the input method of the bean, that will trigger the filtering and consequent event sending.

The PrimitiveValueEmitter is probably the most useful bean, since it can convert a void event to any primitive type of events, like string, integer, boolean, double and so on. All the available types can be seen in the property panel. The value of the primitive type event you want to send has to be configured using these properties too, and all events are triggered by the same method:

  • FireValueEvent(): this method triggers the sending of all primitive type events of the bean.
  • ^EmitTypeValue: an event of a primitive type, sent when FireValueEvent() is invoked, and using the value set in the property TypeValue of the bean.
  • set_TypeValue(Type): a method allowing to remotely set the value that the bean will send (property setter method).
  • beansdoc.1294221839.txt.gz
  • Last modified: 2011/01/05 11:03
  • by hourdin