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: 490
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

Yes No Cancel => Button

Hello guys'

 

I need Yes/No/Cancel dialog windows for my application.

If you have simple code, plz help me guys'

 

Tnx'

Developer
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: Yes No Cancel => Button

[ Edited ]

I have no sample code for that screen.

 

But I can advise you steps to implement it.

 

Implement a class that extends net.rim.device.api.ui.container.PopupScreen class and implements FieldChangeListener

 

Add 3 buttons to the screen, and setup the screen as a listener to these  buttons (note that buttons are fields from its nature)

 

And check in 

 

public void fieldChanged(Field field,
int context)

 

 

method which button has been pressed. And act according to the situation.

 

Good luck.

Message Edited by rafo on 09-08-2008 09:56 AM
----------------
if your issue solved set "Solution" mark at the relevant post
Developer
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

Re: Yes No Cancel => Button

Hi Raiden,

 

checkout this article. It shows simple way to create a YES_NO dialog.

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800429/How_To_...

 

regards,

 

yosoh.

 

 

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();
Developer
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: Yes No Cancel => Button

yosoh, link you posted is about another point.

 

Raiden asked to create Yes/No/Cancel dialog.

 

You provided a link to standard Yes/No dialog. But there is no standard Yes/No/Cancel dialog.

 

And it should be implemented manually.

----------------
if your issue solved set "Solution" mark at the relevant post
Developer
Posts: 19,633
Registered: ‎07-14-2008
My Device: Not Specified

Re: Yes No Cancel => Button

I would use Dialog to do this.  Sorry don't have any sample code immediately to hand, but have knocked up the following, untested, un-compiled code to show you what I mean.  There are other ways of using the Dialog too, but I'll let you review the docs.  Also I quite like using the style Dualog.LIST - give it a try.

 

Dialog d = new Dialog("Message", new String[] {"Yes", "No", Cancel", new int[] {1, -1, 0}, 0, Bitmap.getPredefinedBitmap(Bitmap.QUESTION)); d.doModal(); int result = d.getSelectedValue(); if ( result == 0 ) { // Cancel } else if ( result == 1 ) { // Yes } else { // No }

 

 

 

Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: Yes No Cancel => Button

Tnx all' I got ur ideas'

 

Tnx again'