Hybrid View

  1. #1
    Ext User
    Join Date
    May 2008
    Posts
    27
    Vote Rating
    0
    Daniel Kurka is on a distinguished road

      0  

    Default How to detect which button was pressed in MessageBox.confirm

    How to detect which button was pressed in MessageBox.confirm


    I want to use MessageBox.confirm to confirm a user action. In the explorer demo there is an example, but it is using the text of the button to determine which one was pressed. I cant do that because my buttons are going to have differrent texts at runtime.

    How can I determine if the Okay button or the cancel button was pressed?

    Also i would like to change the text of the buttons (i18n)


    Code:
    final Listener<WindowEvent> l = new Listener<WindowEvent>() {
                public void handleEvent(WindowEvent ce) {
                    Dialog dialog = (Dialog) ce.component;
                    Button btn = dialog.getButtonPressed();
                    Info.display("MessageBox", "The '{0}' button was pressed", btn.
                            getText());
                }
            };
    
            MessageBox.confirm("Confirm", "Are you sure you want to do that?", l);

  2. #2
    Ext User
    Join Date
    Jul 2008
    Location
    China
    Posts
    10
    Vote Rating
    0
    zhou is on a distinguished road

      0  

    Default


    Hi.
    try Dialog.OK.equals(btn.getItemId())

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    9
    Vote Rating
    0
    PeteW is on a distinguished road

      0  

    Default


    I'm using Dialog.YES.equals(btn.getItemId())

  4. #4
    Ext User
    Join Date
    Oct 2008
    Posts
    20
    Vote Rating
    0
    sunshinerain is on a distinguished road

      0  

    Default


    Thanks for the help. I struggled with this because I was using MessageBoxEvent
    instead of WindowEvent. MessageBoxEvent is said to include a Dialog, but
    that was null so I was unable to track down the button.

    A nice enhancement might be to include "String buttonId" in MessageBoxEvent,
    so I could easily obtain the button that was pressed along with the value of text
    in my prompt field. Just a suggestion.

  5. #5
    Sencha User
    Join Date
    Jul 2009
    Posts
    16
    Vote Rating
    0
    sajjan.sarkar is on a distinguished road

      0  

    Smile Also works with MessageBoxEvent

    Also works with MessageBoxEvent


    Code:
    MessageBox.confirm("Confirm", "Are you sure?", new Listener<MessageBoxEvent>() {
                        
        @Override
        public void handleEvent(MessageBoxEvent be) {
                            
                    Button btn =be.getButtonClicked();                       
                     if(Dialog.YES.equalsIgnoreCase(btn.getItemId()))
                    {
                                        // ur stuff
                     }
       }
    });

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi