Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 7
Registered: ‎10-03-2012
My Device: 9810
My Carrier: Bell
Accepted Solution

New line in xml?

I'm calling this method

blackberry.ui.dialog.customAskAsync(blackberry.app.license, buttons, this.dialogCallBack, ops);

And within my config.xml, I have a <license> element where I've put my EULA.

I've tried \n and &#xA; , but both doesn't seem to create a new line when the dialog comes up. How should I create a new line?

Thanks!

Retired
Posts: 165
Registered: ‎09-24-2012
My Device: Passport
My Carrier: Bell

Re: New line in xml?

Hi aaronjylee, I've tested some other methods, but no success. This is because javascript reads the license element data as a string.

Developer
Posts: 26
Registered: ‎06-01-2010
My Device: Dev Alpha, PlayBook

Re: New line in xml?

One way to prompt the user for a license agreement at application start is to just save the license as a string in JavaScript with "\n" for new lines instead of using blackberry.app.license in config.xml. Here is an example:

 

var title = "Application License Agreement";
var message = "Line 1\nLine 2\nLine 3\nLine 4";
var buttons = ["I Agree", "I Disagree"];
var ops = {
    title : title,
    size : blackberry.ui.dialog.SIZE_SMALL,
    position : blackberry.ui.dialog.CENTER
};
var callback = function (result)
{
	if (result == 0)
	{
		// user agreed
		alert("Glad you agreed.");
	}
	else if (result == 1)
	{
		// user disagreed		
		alert("Sorry you didn't agree. Closing the app now.");
		blackberry.app.exit();
	}
};
blackberry.ui.dialog.customAskAsync(message, buttons, callback, ops);

 Cheers,

 

James

___________________________________________________________
My latest Blackberry 10 app Audiobooks! :smileyhappy:

My latest PlayBook app Photojam!

Find me on Twitter: GoGibbons
Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: New line in xml?

This will be solved in the upcoming release of WW. You will be given the ability to send HTML to a dialog, which will give you the ability to control more of your content. You can keep an eye on some of the developments by Daniel here:

 

https://github.com/blackberry-webworks/BB10-WebWorks-Framework/tree/next-testHTML5Dialog

@erikjohnzon
erjohnson@blackberry.com