Chapter 3 - Use variables for duplicate command strings
- StPendl Oct 29, 2011
On a second glance we can see some places, where redundant graphics command strings are used.
To reduce the amount of work to change them, we introduce string variables that hold the command strings.
Streamlining your code
Chapter 3 - Use variables for duplicate command strings
-On a second glance we can see some places, where redundant graphics command strings are used.
To reduce the amount of work to change them, we introduce string variables that hold the command strings.
This way the following lines of code:
Will be replaced by their equivalents where only one line has to be changed:
The complete code now looks like this.
Chapter 1 - Starting the mission
Chapter 2 - Using arrays to reduce redundant code
Chapter 3 - Use variables for duplicate command strings
Chapter 4 - Consolidate event handlers
Chapter 5 - Apply mouse selection
Chapter 6 - Remove radio buttons
Chapter 7 - Use a single graphics box for the resistor display
Chapter 8 - Further reduce the amount of GUI controls (Using hot-spots)
Chapter 9 - Adding some eye-candy
Chapter 10 - Summary