Turning and the Spinner Box
In looking at the interface, I was a little uncomfortable having the user type the amount of degrees they wished the robot to turn into a textbox. I decided that a spinner box, with a minimum value of 0 and a maximum value of 360, would be better. This meant it was time to learn how to use a spinner box. In my first attempt, I wrote the minimum and maximum values using code. However, I soon realized that you could apply a minimum and maximum value from the properties panel of the spinner box. When I figured this out, I erased the code I had written and used the properties panel to apply a minimum and maximum value. I also changed the interval amount to 1, so that when the user clicked on the up or down arrow in the spinner box, the displayed value would increase and decrease by 1 respectively. Next, I created a global variable to store the text string shown in the spinner box. I then wrote the code to convert the text string stored in the variable into a numeric number. The global variable was then placed in the command used to turn the robot. This procedure was added to both the left and right turn buttons.