Print Page | Close Window

Breaking a line in dialog box text

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=851
Printed Date: 29 Mar 2020 at 11:32pm
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: Breaking a line in dialog box text
Posted By: zhirik
Subject: Breaking a line in dialog box text
Date Posted: 11 Jun 2013 at 5:36pm
Hi folks,
 
I'm trying to add 2 lines of text to the "name" property of the dialog box element:
...
elements [{
...,
name: "This is the 1st line \n
             This is the 2nd line"
 
....}]
 
However, the \n instruction is not honored. The dialog only displays the 1st line. How can I add this line break? The script does not even like double space between the lines, nor the 'escaped backlash' ( file://%5C%5Cn - \\n ).
 
Thank you for your response in advance!Smile



Replies:
Posted By: try67
Date Posted: 11 Jun 2013 at 9:01pm
What type of element is it? And did you set the height property to make sure the second line is visible?

-------------
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com


Posted By: zhirik
Date Posted: 12 Jun 2013 at 5:10am
Hi Gilad,

Thanks for your response!

It should just be a static text with OK and Cancel buttons.
I set the width and height of the dialog and the text alignment, but for some reason, the width is ignored and the dialog is too long (I guess it's because the 2nd line of the text stays at the same level as the 1st one (\n is ignored). In addition, although I set the text alignment of the buttons to be centered, they for some reason appear on the right side.

Thank you for your input in advance!
Smile


Posted By: try67
Date Posted: 12 Jun 2013 at 8:07am
I was actually referring to the height (and width) settings of the static_text element, actually.
However, if all you have is static text and OK and Cancel button, just use app.alert(). It's MUCH easier to set up, although less flexible in terms of design.


-------------
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com


Posted By: zhirik
Date Posted: 12 Jun 2013 at 9:54am
Hi Gilad,
 
Thanks for your suggestion! I would like to replace the app.alert() that I am using in my 'Will Close' action with a dialog box  just because there is no "Cancel" button in app.alert() message windows.
Up until now, my script did not have an option to cancel the app.mailMsg execution, and that's what I would like to add.
So, I created a script that triggers the dialog box and put it as a document-level javascript, just to fine-tune the look&feel of the dialog.
 
Originally posted by try67 try67 wrote:

I was actually referring to the height (and width) settings of the static_text element, actually.
However, if all you have is static text and OK and Cancel button, just use app.alert(). It's MUCH easier to set up, although less flexible in terms of design.


Posted By: try67
Date Posted: 12 Jun 2013 at 10:04am
Sure there is. Look at the reference of that method and you'll see how to implement it.

-------------
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com


Posted By: zhirik
Date Posted: 12 Jun 2013 at 10:12am
Hi Gilad,
 
You are right. I overlooked this somehow.Confused
However, what I also need is:
a. Ability to change the default button text (e.g., instead of OK, make it "Send Email")
b. "Commit" operation like in a dialog box that can trigger another action upon clicking OK.
c. Ability to change font.
 
Thank you again for your input!!! Big smile
 
Originally posted by try67 try67 wrote:

Sure there is. Look at the reference of that method and you'll see how to implement it.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net