Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I add context sensitive help to a data entry form?

Tips -N- Tricks

How can I add context sensitive help to a data entry form?

by  ChrisRChamberlain  Posted    (Edited  )
If calling a conventional help file is too cumbersome and/or ToolTipText/labels are inadequate, try the following:-

Add a new property called UseHelp to the data entry form

Add a Checkbox, caption "Data entry help" or similar.
In the valid event of the Checkbox:-

*--
WAIT CLEAR
IF THIS.Value = 0
THISFORM.UseHelp = .F.
ELSE
THISFORM.UseHelp = .T.
* WAIT WINDOW [Click where you need help...] ;
NOWAIT NOCLEAR && Optional message
ENDIF
*--

In the GotFocus event of all enabled controls

*--
IF THISFORM.usehelp
WAIT WINDOW ;
[Enter the date on which etc] ;
+CHR(13) ;
[xxxx xxxx xxx x xxx x xxxxxx] ;
+CHR(13) ;
+CHR(13) ;
+[This date is required etc] ;
+CHR(13) ;
[xxxx x xxxxxx x xx xxxxxx] ;
NOCLEAR NOWAIT
ELSE
WAIT CLEAR
ENDIF
*--
Keep the length of the message sections to approximately the same number of characters, which will format the window correctly.

To position the window in relation to a control, add the "AT nRow,nColumn" argument - the following code will convert pixels to nRow or nCol.

nExtra = 8 && Adjustment for menu and toolbar
nRow = (THIS.Control.Top / 16) + nExtra
nCol = (THIS.Control.Left + THIS.Control.Width) / 6
WAIT WINDOW [Message] ;
AT nRow,nCol NOCLEAR NOWAIT


In the LostFocus event of the control

*--
WAIT CLEAR
*--

The Checkbox enables/disables the context sensitive help.

This code is not designed to replace conventional help files or ToolTipTexts/labels, but to supplement them.

* DISCLAIMER
* This Code is as is. There is no warranty expressed or
* implied. Use this code at your own risk.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top