[texworks] Help please with Integer constants and use in messageboxes

Stefan Löffler st.loeffler at gmail.com
Sat Apr 24 14:01:40 CEST 2010


Hi,

Am 2010-04-24 07:43, schrieb Paul A Norman:
> Still it seems that the correctly named integer constants are not
> available to QTScript engine yet.
>   

That's right. They are essentially just labels for use in the C++ code.
They have no equivalent string in the compiled binary (they are replaced
by the numeric constants by the compiler). As such, we could hard-code
them, but that wouldn't help much. Furthermore, now that general UI
widgets have landed, we'd have to support a very large number of
constants (basically for all widgets), which would be a huge effort. So
for the moment, you'll have to use the hex numbers instead.

> Strangely at the end of running this script (below) I always get a
> unexpected message box with "1024" as the message.
>   

This is the normal behavior of all Qt scripts. The last value specified
is automatically used as return value. In your case, this is the return
value of the message box - in particular, 1024=0x400=QMessageBox::Ok.
The standard way of avoiding the final popup box is to end all scripts
with the line:
undefined;

HTH
Stefan


More information about the texworks mailing list