[texworks] Help please with Integer constants and use in messageboxes
Paul A Norman
paul.a.norman at gmail.com
Fri Apr 23 13:55:32 CEST 2010
Sorry to have to bring this up I should have been able to work this
out, but I've been looking in
http://ldc.usb.ve/docs/qt/qmessagebox.html trying to get dialogs to
work with buttons and capture the return value.
Am I looking in the right place under QT please?
As recomended in http://code.google.com/p/texworks/issues/detail?id=221&q=Script
"You can optionally specify one or more buttons to display
(default is just an "OK" button), and also which
button should be the default. These are specified via numeric
flags; see the QMessageBox documentation for
values."
I realise I must be missing something very obvious, any help appreciated please.
This is what I last tried after I could neither get integers nor their
constants like YesAll to work (YesAll produced an error message).
Using integers 0|2|3 type stuff, or text as below, the message box
works, but only ever shows the OK button, and no return value, always
goes to default as below.
// Experiment
var chosen = TW.information(null, "Some Text", "Some other text",
"&Save" | "&Discard" | "Cancel",0,2);
// 0- Save default button, 2 -
cancel button
switch (chosen)
{
case 0:
TW.information(null, "Save", "Save");
break;
case 1:
TW.information(null, "Disacard", "Disacard");
break;
case 2:
TW.information(null, "Cancel", "Cancel");
break;
default: TW.information(null, "Default", "Default");
}
Paul
More information about the texworks
mailing list