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

Java Development

Reply
Developer
Posts: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind
Accepted Solution

Tying events to the Dialog.ask

Was employing the dialog box ok/cancel pop up for the first time and was unsure how to trigger events based on clicking ok/cancel, what is the best way of accomplishing this? Thanks!

Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: Tying events to the Dialog.ask

Use doModal() method of Dialog it will return the selected index based on that you can perform your task.

Thank you
warm regards
Mohammed Aziz
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Tying events to the Dialog.ask

int choice = Dialog.ask(.....)

 

You can chack choice against Dialog.OK or Dialog.Cancel or whatever as required by the ask parameters.

Developer
Posts: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind

Re: Tying events to the Dialog.ask

Thanks guys, is there a way to incorporate a editfield as well? I know I could make a custom Dialog class but I can't figure out how to get click events on the buttons in that case. I tried just adding buttons on but a custom Dialog requires super(int, etc...) and I don't want to include those parameters.

 

Investigating PopupScreen instead unless anyone has a suggestion.

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Tying events to the Dialog.ask

I generally extend PopupScreen if I need a Dialog that isn't easily made using the standard Dialog parameters.

Developer
Posts: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind

Re: Tying events to the Dialog.ask

popup worked like a charm, thanks all.