Global Functions
JEDIT DLL includes a few global functions:
BOOL IsJEditModified() - return TRUE if any one of the edit fields is modified.
BOOL IsJEditValidateOK() - return TRUE if all the edit input is valid.
void SetJEditValidateKillFocus(BOOL bgJEditValidateType) - determine when to validate a edit field. If the pass-in parameter is TRUE, the data validation occurs during each edit's kill focus; otherwise it happens during data exchange. The latter is the default behavior.
class CIntEdit
CIntEdit makes the associated control an integer control. It only allows users to enter integer numeric value, and it can be manipulated as an integer type.
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetMinValue(int min) - set the minimum value.
void SetMaxValue(int max) - set the maximum value.
Users' input value has to be inside the range if min and/or max values are set.
int GetValue() - return the value of the control.
void SetValue(int value) - set the value of the control.
You can also use '=' to get or set data.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szMinErrorMsg="", LPCSTR szMaxErrorMsg="") - set the customized error message. There are default messages if you do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szMinErrorMsg - to be used when the control value is smaller than the minimum value.
szMaxErrorMsg - to be used when the control value is larger than the maximum value.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nMinErrorMsg=0, UINT nMaxErrorMsg=0) - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from resource based on the string ID.
class CShortEdit
CShortEdit makes the associated control a short integer control. It only allows users to enter short integer numeric value, and it can be manipulated as a short integer type.
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetMinValue(short min) - set the minimum value.
void SetMaxValue(short max) - set the maximum value.
Users' input value has to be inside the range if min and/or max values are set.
short GetValue() - return the value of the control.
void SetValue(short value) - set the value of the control.
You can also use '=' to get or set data.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szMinErrorMsg="", LPCSTR szMaxErrorMsg="") - set the customized error message. There are default messages if you do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szMinErrorMsg - to be used when the control value is smaller than the minimum value.
szMaxErrorMsg - to be used when the control value is larger than the maximum value.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nMinErrorMsg=0, UINT nMaxErrorMsg=0) - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from resource based on the string ID.
class CLongEdit
CLongEdit makes the associated control a long integer control. It only allows users to enter long integer numeric value, and it can be manipulated as a long integer type.
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetMinValue(long min) - set the minimum value.
void SetMaxValue(long max) - set the maximum value.
Users' input value has to be inside the range if min and/or max values are set.
long GetValue() - return the value of the control.
void SetValue(long value) - set the value of the control.
You can also use '=' to get or set data.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szMinErrorMsg="", LPCSTR szMaxErrorMsg="") - set the customized error message. There are default messages if you do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szMinErrorMsg - to be used when the control value is smaller than the minimum value.
szMaxErrorMsg - to be used when the control value is larger than the maximum value.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nMinErrorMsg=0, UINT nMaxErrorMsg=0) - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from resource based on the string ID.
class CFloatEdit
CFloatEdit makes the associated control a float control. It only allows users to enter float numeric value, and it can be manipulated as a float type.
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetMinValue(float min) - set the minimum value.
void SetMaxValue(float max) - set the maximum value.
Users' input value has to be inside the range if min and/or max values are set.
void SetDecimal(int iDecimal) - Set the decimal position.
float GetValue() - return the value of the control.
void SetValue(float value) - set the value of the control.
You can also use '=' to get or set data.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szMinErrorMsg="", LPCSTR szMaxErrorMsg="") - set the customized error message. There are default messages if you do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szMinErrorMsg - to be used when the control value is smaller than the minimum value.
szMaxErrorMsg - to be used when the control value is larger than the maximum value.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nMinErrorMsg=0, UINT nMaxErrorMsg=0) - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from resource based on the string ID.
class CDoubleEdit
CDoubleEdit makes the associated control a double control. It only allows users to enter double numeric value, and it can be manipulated as a double type.
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetMinValue(double min) - set the minimum value.
void SetMaxValue(double max) - set the maximum value.
Users' input value has to be inside the range if min and/or max values are set.
void SetDecimal(int iDecimal) - Set the decimal position.
double GetValue() - return the value of the control.
void SetValue(double value) - set the value of the control.
You can also use '=' to get or set data.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szMinErrorMsg="", LPCSTR szMaxErrorMsg="") - set the customized error message. There are default messages if you do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szMinErrorMsg - to be used when the control value is smaller than the minimum value.
szMaxErrorMsg - to be used when the control value is larger than the maximum value.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nMinErrorMsg=0, UINT nMaxErrorMsg=0) - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from resource based on the string ID.
class CCurrencyEdit
CCurrencyEdit makes the associated control a currency control. It only allows users to enter double numeric value, and it can be manipulated as a double type. CCurrencyEdit formats the entered positive value as "$1,234,456.23" and negative value as "($1,234,456.23)" after KillFocus of the control.
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetMinValue(double min) - set the minimum value.
void SetMaxValue(double max) - set the maximum value.
Users' input value has to be inside the range if min and/or max values are set.
void SetDecimal(int iDecimal) - Set the decimal position.
double GetValue() - return the value of the control.
void SetValue(double value) - set the value of the control.
You can also use '=' to get or set data.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szMinErrorMsg="", LPCSTR szMaxErrorMsg="") - set the customized error message. There are default messages if you do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szMinErrorMsg - to be used when the control value is smaller than the minimum value.
szMaxErrorMsg - to be used when the control value is larger than the maximum value.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nMinErrorMsg=0, UINT nMaxErrorMsg=0) - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from resource based on the string ID.
class CStringEdit
CStringEdit makes the associated control a string control. CStringEdit combines the functionality of both CString and CEdit, and can be easily manipulated. Besides the convenience, CStringEdit uses template to restrict user input, making it a good all purpose edit handle class.
For example, if a programmer sets a template "999-99-9999" as social security number input, users have to enter something like 123-45-6789 into the social security field. Otherwise, a message will popup to remind the user, and focus will be set back into that field.
Multiple templates can be set for one edit control. For example, users may want to enter a telephone number as (123) 456-7890, or 123-456-7890, or 456-7890, or 123-456-7890x2345. In this case, this control's templates will be (999) 999-9999, 999-999-9999, 999-9999, 999-999-9999x9999.
CStringEdit provides following public member functions:
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetTemplate(LPCSTR csTemplate1, LPCSTR csTemplate2="", LPCSTR csTemplate3="", LPCSTR csTemplate4="", LPCSTR csTemplate5="", LPCSTR csTemplate6="", LPCSTR csTemplate7="", LPCSTR csTemplate8="", LPCSTR csTemplate9="", LPCSTR csTemplate10="") - set templates for the control. By default, there is no template.
void SetActiveTemplate(BOOL bActiveTemplate) - there are two ways to check user's input against the template. If the bActiveTemplate is true, the user input is checked cvery time a character is entered. This is the default. Otherwise, the template is checked only after all characters have been entered.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szInvalidErrorMsg="") - set the customized error message. There are default messages if programmers do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szInvalidErrorMsg - to be used when the control value does not match the template.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nInvalidErrorMsg=0) - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from resource based on the string ID.
class CDateTimeEdit
CDateTimeEdit makes the associated control a date/time control. CDateTimeEdit makes sure that user input is a correct date/time value. There is conversion among CDateTimeEdit, CString, and CTime. Thus, a string can be directly assigned to CDateTimeEdit and vice versa. A CDateTimeEdit variable can also be compared with a CString variable, a CTime variable, or another CDateTimeEdit variable. For example, if (m_dtMyVar > CTime::GetCurrentTime()); if (m_dtMyVar != "11/12/1998"); if (m_dtMyVar <= m_dtOtherVar), etc.
CDateTimeEdit provides following public member functions:
void SetAllowEmpty(BOOL bAllowEmpty) - if bAllowEmpty is FALSE, users have to enter a value into this control before leaving the dialog, which makes the control a required field.
void SetFormat(int iFormat) - set the date/time format. The iFormat can take one of the six above mentioned date formats. It this function is not used, SHORT_DATE will be the default format.
int GetFormat() - return the current date/time format.
void SetMinDate(LPCSTR min) - set the minimum date/time value using CString date.
void SetMinDate(const CTime& min) - set the minimum date/time value using CTime date.
void SetMaxDate(LPCSTR max) - set the maximum date/time value using CString date.
void SetMaxDate(const CTime& max) - set the maximum date/time value using CTime date.
Users' input value has to be inside the range if min and/or max values are set.
BOOL IsModified() - return TRUE to indicate the control is modified.
BOOL IsValid() - return TRUE to indicate the control contains valid data.
void SetErrorMessage(LPCSTR szEmptyErrorMsg="", LPCSTR szMinErrorMsg="", LPCSTR szMaxErrorMsg="", LPCSTR szInvalidErrorMsg="") - set the customized error message. There are default messages if programmers do not use this function.
szEmptyErrorMsg - to be used when the control requires input but does not get one.
szMinErrorMsg - to be used when the control value is smaller than the minimum value.
szMaxErrorMsg - to be used when the control value is larger than the maximum value.
szInvalidErrorMsg - to be used when the control value is not a valid date/time value.
void SetErrorMessage(UINT nEmptyErrorMsg=0, UINT nMinErrorMsg=0, UINT nMaxErrorMsg=0, UINT nInvalidErrorMsg="") - this is the same function as the above one except that it takes string ID instead of string itself. JEDIT DLL will send a message to the control's parent to ask conversion from the ID to string. The message id is WM_JEDIT_MESSAGE_FORMAT. In the message handler, the first parameter is the string ID, the second parameter is the string buffer. If you do not handle this message, the DLL will try to load the string from application's resource based on the string ID.