Dialog Events

LuaFAR 3

Dialog Events


Common information about dialog event handler

When the 9-th argument in the far.DialogInit or far.Dialog call is function (event handler), that function will be called by Far whenever any of the numerous dialog events occur.

    ret = fDlgProc (hDlg, Msg, Param1, Param2)

Parameters:

    hDlg   : userdata
    Msg    : integer
    Param1 : integer
    Param2 : depends on Msg

Returns:

    ret    : depends on Msg

Parameters passed to event handler

  1. hDlg: dialog handle. It is the same userdata kind that far.DialogInit returns.
    See description of its methods on far.DialogInit page.
  2. Msg: integer, any DN_* value, e.g. DN_BTNCLICK, DN_CLOSE, etc.
  3. Param1: integer (1-based if it is ID of a dialog element, 0-based otherwise).
  4. Param2: integer for most event types, in accordance to Far API.
    For some events, Param2 is non-integer, see the articles describing those events.

Treating the return value of dialog event handler (in the order of preference)

  1. Return value of nil (or no value) causes DefDlgProc to be called. Its return value is returned to Far.
  2. For some events (DN_CTLCOLORDLGLIST, DN_HELP, etc.), see the return values and their meaning in the article describing that event.
  3. If the return value is number, then that number is returned to Far.
  4. Otherwise, the boolean equivalent of the return value (that is, either 0 or 1) is returned to Far.