TCPmaker : Visual Tour    Sending Messages to Screen Controls  

There are a couple of things we left un-done in this demo project, and which you can add as "exercises for the student:"

Exercise 1: Change the Back and Next buttons at the ends of the page sequence

If you look at a Windows program that uses Back and Next buttons (like TCPmaker!), the appearance or text of these buttons usually changes when you reach the beginning or end of the sequence.

In such programs, when you have clicked the Next button to reach the end of the sequence, usually the text of the Next button will change to something like "Finish", or maybe the button itself will become disabled (greyed out) to indicate that you cannot go any further.

Similarly, when you have clicked the Back button enough times to go all the way to the beginning of the sequence, the Back button may either disappear or become disabled, to indicate that there are no pages before this one.

Your assignment: add such behavior to the CM_Demo project.

Exercise 2: Add an "Auto Repeat" when the user holds down a button on the demo board

The way we implemented the handling of the 4 buttons on the demo board, holding down a particular button on the demo will do nothing: the code will only send out a message when the button is first pressed down.

It might be useful to change the code in some cases, so that if the user holds down one of the buttons on the demo board, the same code will be called again and again, 12 times a second. This will result in messages being sent again and again. 

This could be useful in some cases, but not useful in others. 

For example, for those places where our code sends a new choice to the control, then holding down the button on the demo board would have the effect of rapidly cycling through all the possible choices, which can be useful.  (This is sort of like the auto-repeat capability of your PC keyboard: holding down a key causes the same character to be repeated for as long as the key is held down.)

For those places in our code that only send one message that never changes, then repeating this same message as long as the button on the demo board is held down would NOT be useful: just be a waste of ethernet bandwidth.

Your assignment: identify the places in the CM_Demo source code where it would be useful to repeate the message as long as the button is held down, and modify the code to behave this way.

 

 
  

32 of 33
Copyright Notice and Author Information