Monday, December 13, 2010

Dynamic Display Update

Dynamic Display Update


To illustrate the ability to dynamically update of the display by a user application of the Exploratory Project I added a text box to the second display layer via the display definition file (DF) and a periodic timer component to user application App2. 

The specification of the text box with its widget identifier was all that was necessary to have the Display Application display the text box and then display the date and time in the box each time commands are received to clear the text box and write new text to it.

The addition of a timer component to user App2 that sends commands to display layer 2 of the Display Application was all that was necessary to periodically output the commands for the particular widget identifier.

Upon install, at initialization time, this periodic timer component was registered to be run every 5 seconds.  This component was implemented to read both the system date and time (that is, GMT) and the local date and upon each execution.  Using the system and local times provided by Windows, it then creates a display command topic for layer 2 for the widget and publishes it for the Display Response subcomponent of App2.  Without needing any modification, every time the Display Response subcomponent of the Display component receives the topic it, in turn, automatically transmits it to the Display App.

Whenever the Display App receives the command for the layer it causes the thread that outputs to the particular Windows form for the layer to run.  The command is then decoded and output to the Windows text box control is performed to cause the new values for the date and time to be displayed.  Since the correct user thread is running, Windows problems due to cross-threading of controls is avoided.

Upon running the three applications (Display and the two user applications) the new text box of layer 2 is periodically updated with the date and the two times.  All that was required was the addition of a minor component to the one user application and without any need to modify the Display Application.

No comments: