home *** CD-ROM | disk | FTP | other *** search
- This version of HELLO.PAS for Turbo Vision demonstrates two things:
- 1) how to add a TView object for the Num, Scroll and Caps toggle
- keys and 2) how to create a Shift, Ctrl and Alt sensitive status
- line.
-
- The toggle keys are displayed the same way that the HeapView or
- Clock is displayed. This means that the toggle object's
- (TToggleKeysView) UpDate method is called from TApplication's
- (THelloApp) Idle method. TToggleKeysView.UpDate determines the
- status of the toggle keys and calls its TToggleKeysView.Draw method
- if needed.
-
- The status line will change in response to the Shift, Ctrl or Alt
- keys being held down for about 2 seconds. This is done by adding
- an additional status line for each key in the status line
- definition. The key (no pun intended) here is that each of the
- three additional status line definitions respond to their own help
- context (hcConst). The hard part is setting the current help
- context to the help context that corresponds to the key that is
- pressed and resetting it back to its original state. This process
- uses basically 4 steps:
-
- 1) We determine the data structure of the currently active
- view. i.e. No menu, menu active, dialog active or edit
- window active. Once this is done the type and current
- help context is noted. The type is noted so that we can
- go back to where we were when we need to reset the help
- context.
-
- 2) The help context of the view is changed to the help
- context of the pressed key.
-
- 3) Turbo Vision does it's thing and the status line is
- changed because the help context has changed.
-
- 4) When the key is released the correct type is looked up
- and the view gets its original help context back.
-
- To make more sense of this description please see the code.