DN_EDITCHANGE

Far Manager

DN_EDITCHANGE

The DN_EDITCHANGE event is sent to the dialog callback function when an edit item has changed (for example, a character has been entered).

Param1

The ID of the dialog item that has changed.

Param2

Pointer to the FarDialogItem structure for the item that has changed.

Return

In Dialog API 1.0, the return value is ignored, but to ensure compatibility with future versions of Dialog API, it is recommended to return:
  • TRUE - to confirm the changes
  • FALSE - to cancel the changes

Controls

ControlDescription
DI_COMBOBOX Combined list
DI_EDIT Text input line
DI_FIXEDIT Fixed size text input line
DI_PSWEDIT Password input line

Remarks

  1. The ability to change the state of the dialog item by changing the elements of the FarDialogItem structure is missing in Dialog API 1.0.
  2. The DN_EDITCHANGE event will not be sent in a response to the following messages: DM_SETTEXTPTR and DM_SETTEXT.

Example

...
// show a copy of the entered data only for numbers
if (Msg == DN_EDITCHANGE && Param1 == 2)
{
  FarDialogItem *Item=(FarDialogItem *)Param2;
  int Len=strlen(Item->Data);
  for(int I=0; I < Len; ++I)
    if(!isdigit(Item->Data[I]))
      break;
  if(I == Len)
    return FALSE;
  Info.SendDlgMessage(hDlg, DM_SETTEXTPTR, 3, (LONG_PTR)Item->Data);
  return TRUE;
}
...
See also: