Microsoft KB Archive/80084

-

{| 3.00 3.10 WINDOWS kbprg kbfile The information in this article applies to:
 * width="100%"|


 * Microsoft Windows Software Development Kit (SDK) for Windows versions 3.1 and 3.0

SUMMARY
When an application is designed to gather a large amount of information from the user, the application can quickly consume many system resources due to the number of controls that it creates. Rather than creating many of the same type of control, an application can create one control and move it around.

The ONEEDIT sample in the Software/Data Library demonstrates this technique.

Download ONEEDIT.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

  Microsoft Download Service (MSDL) Dial (206) 936-6735 to connect to MSDL Download ONEEDIT.EXE (size: 36558 bytes)   Internet (anonymous FTP) ftp ftp.microsoft.com Change to the \SOFTLIB\MSLFILES directory Get ONEEDIT.EXE (size: 36558 bytes) 

For more information on what system resources are and how they are consumed, query this Knowledge Base on the following words: system and resources and heap and user and gdi

MORE INFORMATION
ONEEDIT demonstrates collecting data for multiple fields with a single edit control. It collects the following data by moving one control:

Name (First, Middle, Last) Sex Social Security Number Birthday (Month, Day, Year) Address City State Zip Code Phone The results of using this technique are transparent to the user; however, an application designed in this way consumes far fewer system resources because one edit control is used rather than many edit controls. Fifteen fewer controls are required by ONEEDIT because it uses this technique. This savings becomes more significant as the number of controls within an application increases. The ONEEDIT source includes an application programmer's interface (API) that can be added to an application. For more information on the API, see the file API.TXT included in the ONEEDIT archive file.

The remainder of this article lists some of the other techniques implemented in ONEEDIT.

Mouse support - The application performs hit-testing to move the edit control

directly to any valid field. Supports both TAB and SHIFT+TAB keys to move from one field to another - TAB: forward - SHIFT+TAB: backward

Input validation - If the value input for the State field does not correspond to a

valid two-letter state abbreviation (as defined by the U. S.    Postal Service), a Help dialog box is displayed listing the valid abbreviations. - Only a number (or a minus sign) is valid input in some fields (Social Security Number, Birthday, Zip Code, and Phone fields). - The value for the Sex field must be m, M, f, or F. Special case processing to move between fields of the Phone number - Automatically advances to next phone field when one field is

filled. - BACKSPACE moves to the preceding phone field (for example, from    the beginning of the prefix to the end of the area code). - Arrow keys allow movement between fields. Context-sensitive help in State field - The States Help can be invoked directly by pressing F2 when the

cursor is in the State field. Icon automatically changes - The icon displayed in ONEEDIT client area changes depending on

the contents of the Sex field.


 * }

-

Last reviewed: April 7, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.