These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

control execDialog width in Reader 7.0.5? (not an issue with 8 or 9)

roggeheflin
Registered: Oct 7 2008
Posts: 19
Answered

I have created a dialog box in Acrobat 9.0. When the dialog box opens in Reader 7.0.5, the width is larger than the screen's width. During the dialog box initialization, "sta1" is populated with a long text string with no line breaks (\r\n).

I have tried setting [b]width[/b] and [b]char_width[/b] for each element, but the dialog box continued to appear extremely wide. Also, i have removed [b]alignment: "align_fill"[/b].

Reader 8.1.1 does not have this problem.

Ho do I control the width of the execDialog box in Reader 7?

first_tab: "btn1",
name: "My Company",

elements:
[
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "image",
item_id: "img1",
height: 57,
width: 53,
},

{
type: "static_text",
item_id: "tit0",
font: "dialog",
bold: true,
char_height: 4,
name: boxTitle
}

]
},

{
type: "static_text",
item_id: "co1",
font: "dialog",
bold: true,
char_height: coHeight,
name: strPrepared
},

{
type: "static_text",
item_id: "sta1",
alignment: "align_fill",
multiline: "true",
char_height: 24
},

{
type: "static_text",
item_id: "copy",
font: "dialog",
bold: true,
char_height: 2,
name: strCopyright
},

{
type: "static_text",
item_id: "foot",
font: "dialog",
bold: true,
char_height: 6,
name: strFooter
},

{
type: "ok_cancel",
item_id: "btn1",
ok_name: "&Accept",
cancel_name: "&Decline"
}
]

My Product Information:
Acrobat Pro Extended 9.0, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi roggeheflin,

Dialogs were first introduced in Acrobat 7, so there may have been changes with new releases of Acrobat that allow Reader 8 to recognize some element constraints that Reader 7 does not.

You need to wrap all of your elements in a top level element so you can have explicit control over the layout of all elements.

An Acrobat plug-in for easily creating the code for custom dialogs can be found at [url]http://www.windjack.com/products/acrodialogs.php[/url] It can certainly make this easier than hand coding them. You can Demo it and create a few dialogs to get a better handle on how to lay them out how you want, correctly.


Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
roggeheflin
Registered: Oct 7 2008
Posts: 19
A "wrapper" has been added to all the elements in the description. All the elements position properly, as they were before, but the dialog box continues to exceed the width of the screen, even when setting width constraints (Acrobat JavaScript Scripting Reference 7.0.5 states: "Specifies the width of the element in characters. If no width is specified, the combined width of the contents is used.").

• This code does not seem to violate any restraints set forth in the 7.0.5 reference.
• The PDF has been made compatible with Acrobat Version 7.0 and later.
• The "ok_cancel" element appears at the far right; the dialog box width exceeds the width of the screen if this control is not present.
• The width: 700 and width: 500 have no effect on the dialog box. The controls are properly positioned, excepting the "ok_cancel" element, which appears on the far right.
• align_children: "align_left" has no effect in my instance.

what else could it be??...

description:
{name: "My Company",
first_tab: "btn1",
width: 700,

elements:
[
{
type: "view",
width: 550,

elements:
[

{
type: "view",
align_children: "align_row",
elements:
[
{
type: "image",
item_id: "img1",
height: 57,
width: 53,
},

{
type: "static_text",
item_id: "tit0",
font: "dialog",
bold: true,
char_height: 4,
name: boxTitle
}]
},

{
type: "static_text",
item_id: "co1",
font: "dialog",
bold: true,
char_height: coHeight,
name: strPrepared
},

{
type: "static_text",
item_id: "sta1",
alignment: "align_fill",
multiline: "true",
char_height: 24
},

{
type: "static_text",
item_id: "copy",
font: "dialog",
bold: true,
char_height: 2,
name: strCopyright
},

{
type: "static_text",
item_id: "foot",
font: "dialog",
bold: true,
char_height: 6,
name: strFooter
},

{
type: "ok_cancel",
item_id: "btn1",
ok_name: "&Accept",
cancel_name: "&Decline"
}
]
}
]
}
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi roggeheflin,

It's kinda diffuclt to analyze dialog code, especially since that looks like it is not all the code, in a forum. You'll need to share the file with the complete dialog so someone, time permitting, can analyze it for you.

I did notice you have align_children set to align_row- if you look at the Help file for AcroDialogs ( included in the download) there is a table on page 14 showing alignment possibilities, and align_row puts the elements side by side horizontally. Play around with that setting and see if changing that helps.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
roggeheflin
Registered: Oct 7 2008
Posts: 19
I found issue. I had a moment of clarity initiated by your response; this moment indicated that something else might be the issue. Thank you for your help and interest with my problem.

The variable [b]strFooter[/b] is about 216 characters long. In Acrobat versions 8 and 9, the line breaks (\r\n) are recognized as end of line and the static_text element is only about 44 characters wide. In Acrobat 7, the text wraps properly; however, the static_text element takes its width from [b]strFooter[/b] regardless if char_width is set.

I treated this static_text element , "foot", just like the other static_text element with a large amount of text, "sta1".

var strFooter = "some long string more than 200 characters long....."
var numWidth = 46;

var dBox =
{
description:
{name: "My Company",
first_tab: "btn1",
elements:
[
{
type: "view",
char_width: numWidth,
elements:
[

{
type: "view",
align_children: "align_row",
elements:
[
{
type: "image",
item_id: "img1",
height: 57,
width: 53
},
{
type: "static_text",
item_id: "tit0",
font: "dialog",
bold: true,
char_height: 4,
name: boxTitle
}
]
},

{
type: "static_text",
item_id: "com1",
font: "dialog",
bold: true,
char_height: coHeight,
name: strPrepared
},

{
type: "static_text",
item_id: "sta1",
alignment: "align_fill",
multiline: "true",
char_height: 24
},

{
type: "static_text",
item_id: "copy",
font: "dialog",
bold: true,
char_height: 2,
name: strCopyright
},

{
type: "static_text",
item_id: "foot",
alignment: "align_fill",
font: "dialog",
bold: true,
char_height: 6
},

{
type: "ok_cancel",
item_id: "btn1",
ok_name: "&Accept",
cancel_name: "&Decline"
}
]
}
]
}
[i]Additional Dialog box code[i]
};