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

Adobe AIR Development

Reply
Contributor
Posts: 11
Registered: ‎12-10-2010
My Device: Not Specified
Accepted Solution

Popup list event handling

Has anyone been able to get popup list working? I was trying to add one to my application and I was able to get the popup list to come up but could not get the event handling working. The code does not enter the event handling function at all. Can someone please have a look at this code and see what is missing?

 

Thanks

 

 

 public function createRepeatPopup():void
 {
  var popUpSmiley TongueopupList = new PopupList();
  popUp.title = "Wireless Networks";
  popUp.items = ['Home', 'Work', 'Cottage', 'School'];
  popUp.addButton("OK");
  popUp.addButton("Cancel");
  popUp.dialogSize = DialogSize.SIZE_MEDIUM;
  popUp.multiSelect = true;
  popUp.addEventListener(DialogEvent.DIALOG_BUTTON_CLICKED, repeatButtonClicked); 
  popUp.show(IowWindow.getAirWindow().group); 
 }
 private function repeatButtonClicked(e:Event):void
 {
  alert("Repeat button clicked");
 }

 

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Popup list event handling

hey baibhav,

 

its been discussed before that anything that extends the BaseDialog has an error with handling the DialogEvent class. use the following code to fix your error. It should do the job:

 

Replace:

 

 

popUp.addEventListener(DialogEvent.DIALOG_BUTTON_CLICKED, repeatButtonClicked); 

 

 

With:

 

 

popUp.addEventListener(Event.SELECT, repeatButtonClicked); 

 

 

your function to retreive the event will look like:

 

 

public function repeatButtonClicked(e:Event):void
{
	trace("Selected Index of Button: " + e.target.selectedIndex);
}

 

 

that should do the trick. here's the forum thread you can refer to for more information:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Strange-Dialog-Behaviour/m-p/6681...

 

hope that helps. good luck!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Contributor
Posts: 11
Registered: ‎12-10-2010
My Device: Not Specified

Re: Popup list event handling

Thanks Jrab, that worked!!

Contributor
Posts: 11
Registered: ‎12-10-2010
My Device: Not Specified

Re: Popup list event handling

OK one more question around this. I wanted to perform certain action when the use clicks on any item on the list (not the button). Would you know if there is any event fired on the List item click?

 

Thanks,

Baibhav

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Popup list event handling

hey baibhav,

 

that would be theoretically possible if you can attach an event listener to the list object. however the poplist class does provide any sort of reference to their inner objects (except their buttons). your best bet is getting the selected index once the user hits the ok button and process the selectedIndex from there.

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman