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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Developer
RapsFan
Posts: 423
Registered: ‎08-02-2010
My Carrier: Telus
Accepted Solution

How to create delete confirmation dialog

Hello everyone. I am using a DataGrid to display files and folders and have buttons to add folder, delete folder, delete file but I want to add a confirmation popup dialog for when a delete button is pressed. I found one example but it uses the MX FileSystemDataGrid and I couldn't figure out how to extrapolate from that example and apply it to my use. Below is my code, hoping someone can suggest how I can do it.

 

protected function deleteFolder_clickHandler(event:MouseEvent):void
			{
				var dir:File = File.documentsDirectory.resolvePath(folderName.text);
				dir.deleteDirectory();
				folderName.text = "";
				file.getDirectoryListingAsync();
				folderList.refresh();
				list.dataProvider = folderList;
			}
			
			protected function deleteFile_clickHandler(event:MouseEvent):void
			{
				var delFile:File = this.filelist.selectedItem.file as File;
				delFile.deleteFile();
				currentFile.getDirectoryListingAsync();
				fileList.removeAll();
				fileList.refresh();
				filelist.dataProvider = fileList;
				
			}

 

Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 536
Registered: ‎07-15-2008
My Carrier: Bell

Re: How to create delete confirmation dialog

You have those methods set up as the event handlers for the delete buttons. Why don't you create a different method to sit in-between? So your click handler for the delete button goes to a new showConfirmationDialog() method, with an okay button. The click handler for the okay button should be your current delete method. Make sense?

Tim Windsor
Application Development Consultant
Please use plain text.
Developer
RapsFan
Posts: 423
Registered: ‎08-02-2010
My Carrier: Telus

Re: How to create delete confirmation dialog

So build an alert dialog rather than just using Alert.dialog?
Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 536
Registered: ‎07-15-2008
My Carrier: Bell

Re: How to create delete confirmation dialog

You could do either approach. There's the PromptDialog class which would be the native dialog control to use.

Tim Windsor
Application Development Consultant
Please use plain text.
Developer
RapsFan
Posts: 423
Registered: ‎08-02-2010
My Carrier: Telus

Re: How to create delete confirmation dialog

Thanks I'm going to take a look at this class.
Please use plain text.