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

Adobe AIR Development

Posts: 11
Registered: ‎03-01-2013
My Device: Simulator BB10
My Carrier: unknown, company employer

Simple Dialog with multiple inputs

Hey guys, 


i need to prompt the user for 2 or 3 textinputs. 

Basically its a LoginDialog (i use it for testing) without the ****** stars and show the hidden characters.


Best thing i could find was the PromptDialog, I can add buttons, but cannot add messages / labels. 



Can i even extend the qnx-BaseDialog / PromptDialog in the ANE with Lables + Editable Fields ?


Or do i have to write my own component ? - if so how do i implement the modal (PopupManager-Manager) stuff ?


Thank you.


Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Simple Dialog with multiple inputs

I am not certain if this is changed in BB10 (since I dont use those since the PlayBook days), but you were never able to customize the dialog classes since they were a service and not an in-app library.

I use my own. To make it "modal", you add a sprite with a fill color of black at an alpha of about 0.6, then you add your control to the sprite. You are basically cutting off mouse events with the sprite.
Posts: 11
Registered: ‎03-01-2013
My Device: Simulator BB10
My Carrier: unknown, company employer

Re: Simple Dialog with multiple inputs

[ Edited ]

I just tried to extend the Dialog class, the content property is only protected/exposed.

Works fine in simulator. Can anyone test/confirm this on a real device ?





	import flash.events.Event;
	import qnx.fuse.ui.dialog.DialogBase;
	import qnx.fuse.ui.text.Label;
	import qnx.fuse.ui.text.TextInput;
	public class CustomInputDialog extends DialogBase
		private var customInputs:Vector.<TextInput> = new Vector.<TextInput>();
		private var customLabels:Vector.<Label> = new Vector.<Label>();
		public function CustomInputDialog()
		public function addInputItem(label:String, prompt:String = ""):TextInput
			var l:Label = new Label();
			l.text = label;
			var t:TextInput = new TextInput();
			t.prompt = prompt;
			// not working ?
			// content.getChildByName(name) as TextInput
			return t;
		public function getInputAt(index:uint):String
			try {return customInputs[index].text;}
			catch(e:Error) {return "";}
			return "";
		public function getInputItemAt(index:uint):TextInput
			try {return customInputs[index]}
			catch(e:Error) {return null;}
			return null;
		override public function destroy():void
			var t:TextInput;
				t = customInputs.pop();
				if (content.contains(t)){content.removeChild(t);}
			var l:Label;
				l = customLabels.pop();	
				if (content.contains(l)){content.removeChild(l);}
			customInputs = null;
			customLabels = null;




import qnx.fuse.ui.text.KeyboardType;
import qnx.fuse.ui.text.TextInput;

private function showCustomInputDialog():void
	trace("showCustomInputDialog: " + arguments);
	var cid:CustomInputDialog = new CustomInputDialog();
	cid.title = "Muhahaha";
	cid.addInputItem("i am label 0");
	var restricted:TextInput = cid.addInputItem("im the label 1", "Numbers only, gentlemen");
	restricted.softKeyboardType = KeyboardType.NUMBERS;
	// restricted.restrict = "0-9";
	// https://developer.blackberry.com/air/apis/bb10/qnx/fuse/ui/text/KeyboardType.html
	cid.addEventListener(Event.SELECT, handleCustomInputDialog);

private function handleCustomInputDialog(e:Event):void
	var cid:CustomInputDialog = CustomInputDialog(e.target);
	var input_0:String = cid.getInputAt(0);
	var input_1:String = cid.getInputAt(1);
	trace(" cid.selectedIndex: " + cid.selectedIndex);
	trace(" cid.getItemAt(ad.selectedIndex): " + cid.getItemAt(cid.selectedIndex));
	trace("	input_0: " + input_0);
	trace("	input_1: " + input_1);
	// OK label
	if (cid.selectedIndex == 0)