Skip to main content
Dmitriy K.
Known Participant
October 6, 2021
Question

Dialogue window is always in focus

  • October 6, 2021
  • 1 reply
  • 871 views

How to change the code so that when the button is pressed, the dialog window does not close, and it would be possible to re-enter the data in the edittext and click the button again?

app.addMenuItem({ cParent:"Help", cName:"-", cExec:" ", nPos: 0});
app.addMenuItem({ cParent: "Help", cUser: "Test", cName: "Test", cExec: "Test()", cEnable: "event.rc = (event.target != null);",  nPos: 0});

function Test() 
{
var dialog1 = 
{
	Btn1: function(dialog)
	{
		var result = dialog.store()["Txt1"]
		Ndata = result
		dialog.end("Btn1");
	},
	Stop: function(dialog)
	{	
		idx = "Cancel"
		dialog.end("Stop");
	},
	description:
	{name: "Test", align_children: "row", width: 300, height: 300,
		elements:
		[
			{
				alignment: "align_right",
				type: "button",
				name: "Cancel",
				item_id: "Stop",
				width: 5
			},
			{
				type: "edit_text",
				item_id: "Txt1",
				width: 170,
				height: 25
			},
			{
				type: "button",
				name: "Enter date",
				item_id: "Btn1",
			}
		]
	}
};
app.execDialog(dialog1);

		array = this.getPageBox("Crop",1);
		r = array.toString()
		r = r.split(",");
		rectX1 = [Math.round(r[2])-391, 108, Math.round(r[2])-354, 132];
		this.addAnnot({page: 1, type: "Stamp", rect: rectX1, author: "", AP: "#NewDate" })

}; app.trustedFunction(Test);

 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
October 6, 2021

Dialogs in Acrobat are modal. You can't leave interact with the rest of the application while they are open.
What you can do, though, is re-open the dialog after it closed. You would need to re-populate all the fields in it with the old values entered into them, though.

Dmitriy K.
Known Participant
October 7, 2021

Suppose the old data does not need to be filled in again, what would the code look like then? I tried to duplicate the Dialog call, but nothing works.

try67
Community Expert
Community Expert
October 7, 2021

Yes, that should have worked... Can you post your code?