Exploring the TypingBuddy Application (Part 2)

In the previous post of this series, Exploring the TypingBuddy Application (Part 1), you considered why TypingBuddy is a useful application and some of the parameters required to create such an application. Of course, it’s always nice to think about how to put an application together, but actually working on the application is more educational. This post will begin exploring the application design by looking at a few of the forms used to display the application timing (the next post will discuss forms used for configuration purposes).

The first thing to understand is that this application won’t normally appear on screen at all until the typing time is done. The only exception the first time the application is used. In this case, the user sees the following message box stating that the application hasn’t been configured and then the main form appears on screen.

TypingBuddy0101

The default operation is for the application to start and immediately hide the main form. You’ll see an icon in the notification area. Right clicking this icon displays the following choices.

TypingBuddy0202

When the user selects Open Window, TypingBuddy displays the main form. Here’s how frmMain will appear.

TypingBuddy0203

I decided that this example would contain full accessibility settings from the outset, so there are some features you may not have worked with in the past. For example, in order for some screen readers to read the purpose of a particular control, you must provide a ToolTip control on your form. You’ll use the following configuration settings to create frmMain. (The icon is created using precisely the same technique as described for the GrabAPicture application in the “Exploring the GrabAPicture Application (Part 4)” post.)

Control Property Value
Form1 (Name) frmMain
  AcceptButton btnSet
  CancelButton btnQuit
  FormBorderStyle FixedDialog
  ShowInTaskbar False
  Size 298, 294
  Text TypingBuddy Settings
  WindowState Minimized
NotifyIcon1 (Name) ThisNotifyIcon
  Visible True
ContextMenu1 (Name) NotificationMenu
Timer1 (Name) TypeTimer
  Interval 1000
ToolTip1 (Name) toolTip1
Button1 (Name) btnSet
  AccessibleDescription Set the timer interval.
  Location 176, 12
  Size 104, 23
  TabIndex 0
  Text &Save Settings
  ToolTip on toolTip1 Set the timer interval.
Button2 (Name) btnPause
  AccessibleDescription Momentarily pause the timer.
  Location 176, 41
  Size 104, 23
  TabIndex 1
  Text &Pause
  ToolTip on toolTip1 Momentarily pause the timer.
Button3 (Name) btnMinimize
  AccessibleDescription Cause the window to disappear without exiting the program.
  Location 176, 70
  Size 104, 23
  TabIndex 2
  Text &Minimize Window
  ToolTip on toolTip1 Cause the window to disappear without exiting the program.
Button4 (Name) btnChangeMessages
  AccessibleDescription Configure the resting time messages.
  Location 176, 99
  Size 104, 23
  TabIndex 3
  Text &Change Messages
  ToolTip on toolTip1 Configure the resting time messages.
Button5 (Name) btnQuit
  AccessibleDescription Exit the program.
  DialogResult Cancel
  Location 176, 128
  Size 104, 23
  TabIndex 4
  Text &Quit
  ToolTip on toolTip1 Exit the program.
Label1 (Name) lblTimerValue
  Location 12, 9
  Size 158, 13
  TabIndex 5
  Text &Typing interval (in minutes):
NumericUpDown1 (Name) TypingInterval
  AccessibleDescription Enter the typing time in minutes.
  Location 12, 25
  Maximum 1200
  Size 120, 20
  TabIndex 6
  ToolTip on toolTip1 Enter the typing time in minutes.
  Value 60
Label2 (Name) lblRestingValue
  Location 12, 48
  Size 158, 13
  TabIndex 7
  Text &Resting interval (in minutes):
NumericUpDown2 (Name) RestingValue
  AccessibleDescription Enter the resting time in minutes.
  Location 12, 64
  Maximum 1200
  Size 120, 20
  TabIndex 8
  ToolTip on toolTip1 Enter the resting time in minutes.
  Value 10
Label3 (Name) lblTypingTime
  Location 12, 87
  Size 158, 13
  TabIndex 9
  Text Time Left (in Seconds):
TextBox1 (Name) txtTypingTime
  AccessibleDescription Displays the remaining time in seconds.
  Location 12, 103
  ReadOnly True
  Size 100, 20
  TabIndex 10
  Text
  ToolTip on toolTip1 Displays the remaining time in seconds.
CheckBox1 (Name) chkShowIcon
  AccessibleDescription Displays the icon on the message box.
  Location 12, 129
  Size 158, 17
  TabIndex 11
  Text Display Message Box &Icon
  ToolTip on toolTip1 Displays the icon on the message box.
CheckBox2 (Name) chkPlaySound
  AccessibleDescription Plays a sound when the message box opens.
  Location 12, 152
  Size 158, 17
  TabIndex 12
  Text Pla&y Sound
  ToolTip on toolTip1 Plays a sound when the message box opens.

Configuring the ContextMenu, NotificationMenu, is important. In order to perform this task, you must click the Edit Menu link in the lower part of the Properties window. When you click this link, the display will change as shown here (this menu is fully configured).

TypingBuddy0203a

As you can see, you simply type the menu options you want to create. The names of these three menu entries are mnuOpen, mnuPause, and mnuExit. Except for assigning each menu entry a (Name) and Text property, you won’t do anything with them for now. Later posts will describe how to work with this menu.

Of course, the purpose of TypingBuddy is to display a dialog box telling you that it’s time to stop typing for a while. The original version of this program used a simple MessageBox, but this approach has quite a few problems, not the least of which is that you can’t force a MessageBox to appear on top of everything else. It’s easy to miss the message to quit typing for a while. With this in mind, the latest version of TypingBuddy uses frmMessage to display the message to rest as shown here.

TypingBuddy0204

The configuration settings might be a little more complex than you might think. For one thing, this dialog box requires a separate timer for resting time. The following table shows the configuration settings for this dialog box.

Control Property Value
Form2 (Name) frmMessage
  AcceptButton btnContinue
  CancelButton btnQuit
  ControlBox False
  FormBorderStyle FixedDialog
  MinimizeBox False
  MaximizeBox False
  Size 290, 290
  Text Time to Rest
  Topmost True
Timer1 (Name) RestTimer
  Interval 1000
ToolTip1 (Name) toolTip1
Button1 (Name) btnContinue
  AccessibleDescription Displays the resting time or allows the program to continue.
  DialogResult OK
  Location 197, 12
  Size 75, 23
  TabIndex 0
  Text &Continue
  ToolTip on toolTip1 Displays the resting time or allows the program to continue.
Button2 (Name) btnQuit
  AccessibleDescription Exit the program.
  DialogResult Cancel
  Location 197, 41
  Size 75, 23
  TabIndex 1
  Text &Quit
  ToolTip on toolTip1 Exit the program.
Label1 (Name) lblMessage
  Location 12, 9
  Size 50, 13
  TabIndex 2
  Text &Message
TextBox1 (Name) txtMessage
  AccessibleDescription Displays the activity to pursue while resting.
  Location 12, 25
  Multiline True
  ReadOnly True
  Size 179, 225
  TabIndex 3
  Text Time to Rest! Take a break!
  ToolTip on toolTip1 Displays the activity to pursue while resting.

That’s it for this week. Next week, we’ll discuss forms you’ll need to create so that the user can design custom messages. Let me know if you have any question about these forms at John@JohnMuellerBooks.com. You can see the next post in this series at Exploring the TypingBuddy Application (Part 3).