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
Contributor
NgCo_Binh
Posts: 41
Registered: ‎08-28-2011
My Device: 9800

How do I creat button with name "View" on a dialog ?

I am making a dialog . I want to creat two button is (" View " ) and " Cancel " button. How do I creat " View " button on Dialog ?

 

New Contributor
tylerle
Posts: 5
Registered: ‎08-26-2011
My Device: Torch 9800

Re: How do I creat button with name "View" on a dialog ?

Using PopupScreen to implement it.

 

 public class CustomDialog extends PopupScreen {
   
    public CustomDialog() {
        super(new VerticalFieldManager(), Field.FOCUSABLE);
       
        LabelField title = new LabelField("Title");
        ButtonField button1 = new ButtonField("View");
        ButtonField button2 = new ButtonField("Canel");
        add(title);
        add(new SeparatorField());
        add(button1);
        add(button2);
    }
}

Developer
simon_hain
Posts: 16,354
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How do I creat button with name "View" on a dialog ?

you can use one of the overloaded constructors, for example http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/ui/component/Dialog.html#Dialo... java.lang.Object[], int[], int, net.rim.device.api.system.Bitmap)

it allows you to define the choices (for exampke "View" and "Cancel") yourself.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter