Detailed Description
- See also:
- Class ICustomControl, Custom Controls.
- Description:
- This control is a simple text input control. The user may type
any string into the field and the plug-in is notified when the user
presses the ENTER key. There are also methods to parse and return
integer and floating point values entered in the control.
To initialize the pointer to the control call:
ICustEdit
*GetICustEdit(HWND hCtrl);
To release the control call:
ReleaseICustEdit(ICustEdit *ice);
The value to use in the Class field of the Custom Control Properties dialog is:
CustEdit
The following messages may be sent by the edit control:
This message is sent when the control gets focus or when the user
presses the ENTER key while using the control.
WM_CUSTEDIT_ENTER
wParam contains the custom edit control resource ID.
lParam contains the HWND of custom edit control.
#include <custcont.h>
List of all
members.
Member Function Documentation
virtual void GetText |
( |
MCHAR * |
text, |
|
|
int |
ct |
|
) |
|
[pure virtual] |
- Parameters:
-
text |
Storage for the text to retrieve. |
ct |
Specifies the maximum length of the string returned. |
virtual void GetText |
( |
MSTR & |
text |
) |
const [pure virtual] |
- Parameters:
-
text |
Storage for the text to retrieve. |
virtual int GetTextLength |
( |
|
) |
const [pure virtual] |
virtual void SetText |
( |
const MCHAR * |
text |
) |
[pure virtual] |
- Parameters:
-
text |
The text to place in the control. |
virtual void SetText |
( |
int |
i |
) |
[pure virtual] |
- Parameters:
-
i |
This value is converted to a string and displayed in the
control. |
virtual void SetText |
( |
float |
f, |
|
|
int |
precision =
3 |
|
) |
|
[pure virtual] |
- Parameters:
-
f |
This value is converted to a string and displayed in the
control. |
precision |
The precision argument is simply the number of decimal places
that get represented in the string that appears in the edit field.
So if the arguments were (1.0f/3.0f, 3) then the string "0.333"
would appear in the edit field. |
virtual int GetInt |
( |
BOOL * |
valid = NULL |
) |
[pure virtual] |
- Parameters:
-
valid |
This pointer, if passed, is set to TRUE if the input is
'valid'; otherwise FALSE. FALSE indicates that something caused the
parsing of the input to terminate improperly. An example is a
non-numeric character. So for example, if the user entered
"123jkfksdf" into the field the valid pointer would be set to
FALSE. |
virtual float GetFloat |
( |
BOOL * |
valid = NULL |
) |
[pure virtual] |
- Parameters:
-
valid |
This pointer, if passed, is set to TRUE if the input is
'valid'; otherwise FALSE. FALSE indicates that something caused the
parsing of the input to terminate improperly. An example is a
non-numeric character. So for example, if the user entered
"123jkfksdf" into the field this pointer would be set to
FALSE. |
virtual void SetLeading |
( |
int |
lead |
) |
[pure virtual] |
- Parameters:
-
lead |
This parameter specifies the number of pixels to offset. |
virtual void WantReturn |
( |
BOOL |
yesNo |
) |
[pure virtual] |
- Parameters:
-
yesNo |
If TRUE, then when the user presses the RETURN key in that
control, the edit field will send an EN_CHANGE message to
the owner, and calling GotReturn()
will return TRUE. |
- Sample Code:
- Below is the way this is handled by the Hit By Name dialog. In
that dialog, when the user enters a wild card pattern into the name
match field and presses RETURN, the dialog is exited with the items
matching the pattern selected. The way this is accomplished is by
pass TRUE to WantReturn()
and then processing the EN_CHANGE message on the control. If
GotReturn()
is TRUE the Win32 function PostMessage() is used to send the
IDOK message to exit the dialog. If this wasn't done,
pressing RETURN in the edit control would only enter the text --
the user would have to move the mouse over the OK button and press
it.
case IDC_HBN_PATTERN:
if (HIWORD(wParam)==EN_CHANGE)
{
iName = GetICustEdit(GetDlgItem(hDlg,IDC_HBN_PATTERN) );
iName->GetText(buf,256);
ct = _tcslen(buf);
if(ct && buf[ct-1] != _M('*'))
_tcscat(buf, _M("*"));
SendMessage(sbn->hList, LB_RESETCONTENT, 0, 0);
sbn->SetPattern(GetDlgItem(hDlg, IDC_HBN_PATTERN), buf);
sbn->BuildHitList(ct);
if(iName->GotReturn())
PostMessage(hDlg,WM_COMMAND,IDOK,0);
ReleaseICustEdit(iName);
}
break;
virtual BOOL GotReturn |
( |
|
) |
[pure virtual] |
virtual void GiveFocus |
( |
|
) |
[pure virtual] |
virtual BOOL HasFocus |
( |
|
) |
[pure virtual] |
virtual void WantDlgNextCtl |
( |
BOOL |
yesNo |
) |
[pure virtual] |
- Parameters:
-
yesNo |
TRUE to enable the TAB key to move to the next control; FALSE
to disable the TAB key from moving the focus. |
virtual void SetNotifyOnKillFocus |
( |
BOOL |
onOff |
) |
[pure virtual] |
- Parameters:
-
onOff |
TRUE to turn on; FALSE to turn off. |
virtual void SetBold |
( |
BOOL |
onOff |
) |
[pure virtual] |
- Parameters:
-
onOff |
TRUE to turn bolding on; FALSE to turn off. |
virtual void SetParamBlock |
( |
ReferenceTarget * |
pb, |
|
|
int |
subNum |
|
) |
|
[pure virtual] |
ICustEdit ICustEdit ICustEdit ICustEdit
ICustEdit ICustEdit ICustEdit ICustEdit ICustEdit ICustEdit
ICustEdit ICustEdit ICustEdit ICustEdit
ICustEdit ICustEdit ICustEdit ICustEdit ICustEdit ICustEdit