[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.20.2 Signals: Responding To User Input

AWS implements a slot/signal mechanism for responding to user input.

All AWS components are signal sources, which means that you should be able to find out anything important that happens to them by creating appropriate sinks. The idea here is that the application provides certain services. The GUI is event driven, which means that you're not so much interested in finding out when a certain button is clicked, but rather you would like to know when a user wants to do something. For example, you don't care so much that the "Login" button has been pressed or toggled or selected or whatever it is that happens to the "Login" button to activate it, but rather that the user wants to login to the system. In the window definition file, connection maps that a GUI designer can hook up to signal sinks defined by an application programmer support this paradigm. For a game, this model seems especially appropriate.

For example, say the application programmer has defined a sink called `loginSink'. This sink has a few triggers: `login', `setusername', and `setpassword'. In order to have the login proceed, all of these triggers must be activated. The simplest method would be to hookup the `TextChanged' signal from the text boxes to the `setusername' and `setpassword' triggers. Both of these triggers might expect to receive a source that is an `awsComponent' supporting the property `Text'. A command button's `Clicked' signal could be connected to the `login' trigger.

Once everything is properly connected, the following sequence occurs:

  1. The user enters text into the username box. A signal is sent to the `setusername' trigger, which tries to extract the value of the `Text' property using the component's GetProperty() method. If this succeeds, it stores a copy of the text.
  2. The user types in the password box. The same process occurs here.
  3. The user clicks on the "Login" button. The `Clicked' signal is sent to the `login' trigger, which then performs some sort of authentication. It might also then call some controlling object to hide the window and change the display to an menu or something other.

This is the general way that you interact with the user. The controlling principle being that the application developer provides the means; whereas the GUI designer provides the manner. AWS tries to separate controller and view semantics as much as possible.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated using texi2html 1.76.