Skip to main content
Dmitriy K.
Known Participant
Oct 6, 2021 4:17 PM UTC
Question

Dialogue window is always in focus

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 is closed to new replies. Start a new post to keep the conversation going.

9 replies

try67
Community Expert
Community Expert
Oct 6, 2021 4:26 PM UTC

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.

Translate
Dmitriy K.
Known Participant
Oct 7, 2021 4:32 AM UTC

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.

Translate
try67
Community Expert
Community Expert
Oct 7, 2021 5:33 AM UTC

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

Translate