Copy link to clipboard
Copied
I would like to display the page number of the current document in a dialog box. However, in the dialog box the page number always appears with a decimal point and six zeros. For a 64-page document I get the indication: 64.000000. Why is that? Since I want to continue calculating with this specification, I need the number without the decimal point and without the zeros.
// Dialog Definition
var oDlg = {
strName1: "",
initialize: function (dialog) {
dialog.load({
"page": this.strName1,
});
},
commit: function (dialog) {
var data = dialog.store();
this.strName1 = data["page"];
},
description: {
name: "Window titel",
elements:
[{
type: "view",
elements:
[{
type: "cluster",
name: "Page count",
align_children: "align_left",
elements:
[{
type: "view",
elements: [{
type: "static_text",
name: "Pages in this document: ",
}, {
item_id: "page",
type: "edit_text",
readonly: "true",
char_width: 25,
}
]
},
]
}, {
type: "ok_cancel",
},
]
},
]
}
};
// Dialog Activation
oDlg.strName1 = this.numPages;
if ("ok" == app.execDialog(oDlg)) {
console.println("Lin1: " + oDlg.strName1);
}
Does anyone have a hint for me why the dialog box does not display the page number correctly?
Regards
yosimo
That's how numbers are displayed in the dialog object.
To change it you need to convert the value to a string. You can do so by changing this line:
"page": this.strName1,
To this:
"page": ""+this.strName1,
Copy link to clipboard
Copied
That's how numbers are displayed in the dialog object.
To change it you need to convert the value to a string. You can do so by changing this line:
"page": this.strName1,
To this:
"page": ""+this.strName1,
Copy link to clipboard
Copied
Ohh yes, that works.
Thank you very much.
Regards
Yosimo