Is it possible to position a simple dialog over the lister?

using
var txt = DOpus.Dlg.GetString("Enter name of Backup", date);
for simple dialog, is it possible to position it ?

Use the Dialog.window property to set its parent window, it will appear centred over that.

Setting Dlg.window does not work on one-liner dialogs, it still centres on the monitor, but trial and error uncovered this nougat which does centre on the lister.

var txt = DOpus.listers.lastactive.Dlg.GetString("Enter name of Backup", date);

I don't know what a one-liner dialog is sorry.

If you're running in an OnClick event then you are given a Dialog object which already has the correct lister set as its parent. Just use that object.

DOpus.listers.lastactive will not always be the lister which launched the button/script you are in. It only makes sense to use that for things which were not launched from a lister.

Nothing is forcing you to do everything on a single line. Although you can do so in this case, by using the right object, it's a strange complaint to make.

Here is the code for simple BACKUP all button that asks for name of backup,

function OnClick(clickData)
{
var date = new Date();
var y = date.getFullYear().toString();
var m = (date.getMonth() + 1).toString();
var d = date.getDate().toString();

if (m.length === 1) m = "0".concat(m);
if (d.length === 1) d = "0".concat(d);

date = y + "-" + m + "-" + d;

//var txt = DOpus.listers.lastactive.Dlg.GetString("Enter name of Backup", date);
var txt = clickData.Dlg.GetString("Enter name of Backup", date);

if (txt === undefined) return;

var path = "C:\\Users\\user\\Documents\\Directory Opus Backups\\";
var command = 'Prefs BACKUP=all TO=';
command += '"' + path;
command += txt + '"';
command += ' QUIET';

clickData.func.command.RunCommand(command);
}

using
var txt = clickData.Dlg.GetString("Enter name of Backup", date); produces error

image

appreciate the help.

It should be clickData.func.Dlg
https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Scripting/Func.htm

facepalm - of course many thanks.