DN_RESIZECONSOLE

Far Manager

DN_RESIZECONSOLE

The DN_RESIZECONSOLE event is sent to the dialog callback function after the console window size has changed (for example, when the user presses Alt-F9).

Param1

0

Param2

Pointer to a COORD structure containing the current size of the console.

Return

TRUE.

Controls

ControlDescription
Dialog This event apllies only to the dialog

Remarks

The DN_RESIZECONSOLE message is useful in the case when a dialog can adapt to the current size of the console. An example of such functionality is the Find files dialog (Alt-F7).

Example

Adaptation of Find File's (Alt-F7) dialog size when console size changes:
case DN_RESIZECONSOLE:
{
  COORD coord=(*(COORD*)Param2);
  SMALL_RECT rect;
  int IncY=coord.Y-DlgHeight-4;

  ...

  Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0);

  Info.SendDlgMessage(hDlg,DM_GETDLGRECT,0,(LONG_PTR)&rect);
  coord.X=rect.Right-rect.Left+1;
  DlgHeight+=IncY;
  coord.Y=DlgHeight;

  if (IncY > 0)
    Info.SendDlgMessage(hDlg,DM_RESIZEDIALOG,0,(LONG_PTR)&coord);

  for (I=0; I < 2; I++)
  {
    Info.SendDlgMessage(hDlg,DM_GETITEMPOSITION,I,(LONG_PTR)&rect);
    rect.Bottom+=(short)IncY;
    Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,I,(LONG_PTR)&rect);
  }

  for (I=2; I < 10; I++)
  {
    Info.SendDlgMessage(hDlg,DM_GETITEMPOSITION,I,(LONG_PTR)&rect);
    if (I==2)
      rect.Left=-1;
    rect.Top+=(short)IncY;
    Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,I,(LONG_PTR)&rect);
  }

  if (IncY <= 0)
    Info.SendDlgMessage(hDlg,DM_RESIZEDIALOG,0,(LONG_PTR)&coord);

  Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0);

  ...

  return TRUE;
}
See also: