far.SendDlgMessage

LuaFAR 3

far.SendDlgMessage


Result = far.SendDlgMessage (hDlg, Msg, Param1, Param2)
    or
Result = hDlg:send (Msg, Param1, Param2)

Parameters:
  hDlg:   userdata
  Msg:    flags
  Param1: integer (1-based where it is element index, 0-based otherwise)
  Param2: (depends on Msg)

Returns:
  Result: (depends on Msg)

Details:

DM_CLOSE,
DM_EDITUNCHANGEDFLAG,
DM_ENABLE,
DM_ENABLEREDRAW,
DM_GETCHECK,
DM_GETCURSORSIZE,
DM_GETDLGDATA,
DM_GETDROPDOWNOPENED,
DM_GETFOCUS,
DM_GETITEMDATA,
DM_LISTGETDATASIZE,
DM_LISTSORT,
DM_REDRAW,
DM_SET3STATE,
DM_SETCURSORSIZE,
DM_SETDLGDATA,
DM_SETDROPDOWNOPENED,
DM_SETFOCUS,
DM_SETINPUTNOTIFY,
DM_SETITEMDATA,
DM_SETMAXTEXTLENGTH,
DM_SETMOUSEEVENTNOTIFY,
DM_SHOWDIALOG,
DM_SHOWITEM,
DM_USER:
    Param2:  integer
    Result:  integer

DM_ADDHISTORY,
DM_LISTADDSTR,
DM_SETHISTORY,
DM_SETTEXT,
DM_SETTEXTPTR:
    Param2:  string
    Result:  integer

DM_GETCURSORPOS,
DM_GETDIALOGINFO,
DM_GETDLGRECT,
DM_GETEDITPOSITION,
DM_GETITEMPOSITION,
DM_GETSELECTION,
DM_LISTGETCURPOS,
DM_LISTGETTITLES,
DM_LISTINFO:
    Param2:  none
    Result:  table, or nil

DM_GETDIALOGTITLE,
DM_GETTEXT,
DM_GETCONSTTEXTPTR:
    Param2:  none
    Result:  string

DM_KEY:
    Param1:  ignored, specify nil for clarity.
    Param2:  table (array), or string
             - If it is an array then each array element should be a tInputRecord.
             - If it is a string, then it is treated as a sequence of keys separated
               by whitespaces, e.g., "a b CtrlC ShiftHome D". The syntax of keys is
               the same as in Far Manager macros.
    Result:  integer

DM_LISTADD,
DM_LISTSET:
    Param2:  table (array of tables)
    Result:  integer
    Example:
      res = far.SendDlgMessage(hDlg, "DM_LISTADD", id,
        { { Text="added line 1" },
          { Text="added line 2", Flags="LIF_CHECKED" } })

DM_LISTDELETE:
    Param2:  table, or nil
    Result:  integer
    Example:
      res = far.SendDlgMessage(hDlg, "DM_LISTDELETE", id,
        { StartIndex=1, Count=2 })

DM_LISTFINDSTRING:
    Param2:  table
    Result:  integer, or nil
    Example:
      res = far.SendDlgMessage(hDlg, "DM_FINDSTRING", id,
        { StartIndex=1, Pattern="File??.txt" })

DM_LISTGETITEM:
    Param2:  integer (ItemIndex)
    Result:  table, or nil

DM_LISTINSERT,
    Param2:  table
    Result:  integer, or nil
    Example:
      res = far.SendDlgMessage(hDlg, "DM_LISTINSERT", id,
        { Index=2, Text="Hello World", Flags="LIF_CHECKED" })

DM_LISTUPDATE:
    Param2:  table
    Result:  boolean
    Example:
      res = far.SendDlgMessage(hDlg, "DM_LISTUPDATE", id,
        { Index=2, Text="Hello World", Flags="LIF_CHECKED" })

DM_LISTSETCURPOS:
    Param2:  table
    Result:  integer
    Example:
      res = far.SendDlgMessage(hDlg, "DM_LISTSETCURPOS", id,
        { SelectPos=5, TopPos=2 })
    Note:
      Elements numbering is 1-based.

DM_LISTSETTITLES:
    Param2:  table
    Result:  integer
    Example:
      res = far.SendDlgMessage(hDlg, "DM_LISTSETTITLES", id,
        { Title="hello", Bottom="goodbye" })

DM_LISTGETDATA:
    Param2:  integer (1-based list index)
    Result:  either of
               - nil - if Far returned 0
               - light userdata (raw data pointer) - if alien data detected
               - value passed by the last DM_LISTSETDATA call

DM_LISTSETDATA:
    Param2:  table
               ["Index"] - integer (1-based list index)
               ["Data"]  - any Lua value except nil
    Result:  integer (returned from Far)

DM_GETDLGITEM:
    Param2:  table, or nil
    Result:  table, or nil
    Note:
      res = far.SendDlgMessage(hDlg, "DM_GETDLGITEM", numitem, item)
          is equivalent to
      res = far.GetDlgItem(hDlg, numitem, item)

DM_SETDLGITEM:
    Param2:  table
    Result:  boolean
    Note:
      res = far.SendDlgMessage(hDlg, "DM_SETDLGITEM", numitem, item)
          is equivalent to
      res = far.SetDlgItem(hDlg, numitem, item)

DM_MOVEDIALOG:
    Param1:  integer (0=relative, otherwise absolute coordinates)
    Param2:  table
    Result:  table
    Example:
      res = far.SendDlgMessage(hDlg, "DM_MOVEDIALOG", 0, { X=5, Y=-2 })

DM_RESIZEDIALOG:
    Param2:  table
    Result:  table

DM_SETCHECK:
    Param2:  flag
    Result:  integer

DM_SETCURSORPOS:
    Param2:  table
    Result:  integer

DM_SETITEMPOSITION:
    Param2:  table
    Result:  integer
    Example:
      res = far.SendDlgMessage(hDlg, "DM_SETITEMPOSITION", id,
        { Left=3, Top=3, Right=20, Bottom=5 })

DM_SETSELECTION:
    Param2:  table
    Result:  integer
    Note: this function has much in common with editor.Select

DM_SETCOMBOBOXEVENT:
    Param2:  flags
    Result:  integer

DM_SETEDITPOSITION:
    Param2:  table
    Result:  integer
    Example:
      res = far.SendDlgMessage(hDlg, "DM_SETEDITPOSITION", id,
        { CurPos=3, Overtype=0 })

DN_BTNCLICK,
DN_DRAGGED,
DN_DRAWDIALOG,
DN_DRAWDIALOGDONE,
DN_DROPDOWNOPENED,
DN_ENTERIDLE:
    Param2:  integer
    Result:  integer

DN_CONTROLINPUT:
    Param2:  tInputRecord or string
    Result:  integer

Far API used:
  SendDlgMessage