Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

inheritDialog parameter for dialog box

Community Expert ,
Jul 02, 2024 Jul 02, 2024

Hi,

Does anybody could try try to explain to me the "inheritDialog" parameter for a dialog box, and how to use it?

The API reference says :"A Dialog object that should be reused when displaying this dialog box. It is useful when displaying a series of dialog boxes (such as a wizard) to prevent one from disappearing before the new one is displayed. The default is not to reuse a dialog box."

I am doing a series of nested dialog boxes that seems to work fine (without this parameter) and I'm wondering if I need to use it. If so, how use this setting ?

Thanks in advance.

@+

TOPICS
JavaScript , PDF forms
706
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jul 03, 2024 Jul 03, 2024

I don't think I ever implied that you have access to the previous dialog's properties. This is not inheritance in the OO sense. 

 

Let's take a step back: You want to use two or more dialogs that all appear in the same spot on the screen. You can create one dialog and then when the user clicks on the "OK" button destroy this dialog and create the second. This will create some flicker on the screen: One window goes away and a second one gets created. 

 

When you look at the installation wizard you get when you install software, there is one frame that stays on the screen throughout the process, but the contents are different. This is what you get with the inheritDialog parameter. You still have to fill in the details by providing a new dialog object with text fields, radio buttons, and so on. The only thing you get is that the window never disappears. 

 

There is a good chance that you do not need this parameter. I've been programming with Acrobat's JavaScript for a long time, and I've never used it in an actual project. 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

This is for using the same dialog box, but with different contents (like in a wizard where every step uses the same frame), if you have nested dialogs, they are all in their own boxes, so you should not use this parameter. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

OK, thank you.

So what does mean "It is useful when displaying a series of dialog boxes..."? A series of consecutive dialog boxes (one after an other one) or elements refreshed (or new elements) in a single dialog box? And "... to prevent one from disappearing before the new one is displayed."? I never noticed that!

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

Again, this is for impementing something like a wizard (https://en.wikipedia.org/wiki/Wizard_(software)) where you have one dialog with different contents for the different e.g. installation steps a user needs to perform. You don't want that dialog window to go away when you create the contents for the next step. That is when you "inherit" the previous dialog, but fill it with new content.   

 

The easiest way to understand what it does by just trying it: Create one dialog where the "OK" button closes the first dialog and creates a second dialog, but do not use the inheritDialog parameter, then do the same excercise again, but use the inheritDialog parameter and provide the dialog object of the first dialog. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

I think I pretty much understand, thanks. I will try you test!

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2024 Jul 03, 2024

@Karl Heinz Kremer 

If I understand well, you have a script for a first dialog box...

Capture d’écran 2024-07-03 à 14.22.58.pngexpand image

...and an other one for a second one

Capture d’écran 2024-07-03 à 14.23.41.pngexpand image

The inheritDialog parameter should be able to directly recover the value of the edit text window from the first dialog box into the second one. Correct?

Where and how to place this parameter in the script of the second dialog box??? In the script below, for example (the script of the first one being the same):

var dialog={
	description: {
		name: "Second Dialog box",
		elements: [
			{
				type: "view",
				elements: [
					{
						type: "view",
						alignment: "align_top",
						elements: [
							{
								type: "edit_text",
								item_id: "edtx",
								width: 150,
								height: 20
							},
						]
					},
					{
						type: "ok_cancel",
					},
				]
			},
		]
	}
};

Thanks.

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2024 Jul 03, 2024

I don't think I ever implied that you have access to the previous dialog's properties. This is not inheritance in the OO sense. 

 

Let's take a step back: You want to use two or more dialogs that all appear in the same spot on the screen. You can create one dialog and then when the user clicks on the "OK" button destroy this dialog and create the second. This will create some flicker on the screen: One window goes away and a second one gets created. 

 

When you look at the installation wizard you get when you install software, there is one frame that stays on the screen throughout the process, but the contents are different. This is what you get with the inheritDialog parameter. You still have to fill in the details by providing a new dialog object with text fields, radio buttons, and so on. The only thing you get is that the window never disappears. 

 

There is a good chance that you do not need this parameter. I've been programming with Acrobat's JavaScript for a long time, and I've never used it in an actual project. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2024 Jul 03, 2024
LATEST
quoteThere is a good chance that you do not need this parameter. I've been programming with Acrobat's JavaScript for a long time, and I've never used it in an actual project. 

By Karl Heinz Kremer

 

So I'm giving up!

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines