Bind events to the Dialog.ask

Using the dialog box pop ok/cancel for the first time and didn't know how to trigger events based on clicking on ok/cancel, what is the best way to solve this problem? Thank you!

Generally, I would like to PopupScreen if I need a dialogue that does not easily using the standard dialog box settings.

Tags: BlackBerry Developers

Similar Questions

  • Issue of change event in the dialog box.

    Hi all

    I'm having a problem with a user dialog box. The dialog box should use eventchange to update aspects of the dialog box based on a user selection in a drop-down list box. The problem I encounter is that eventchange does not recognize the change of no selection to the first selection. IE, a user will have to select something else first, then change to what they want to be recognized. Is there something better that would solve this problem? or is the problem something else entirely?

    Thank you

    Artemis

    Hey, Artemis,

    The simplest solution would be to use the event EventInitialize to set the combo box to a default value when the dialog box opens, and your settings dialog box to match the selection.  In this way the first change makes the user would trigger change of value.

  • Print button to print the page 10 to the dialog asking the user how many times to print page 10

    Hi all

    Want javascript to attach to a button that does the following: -.

    ask the user in the dialog box how many copies of page 10, they wish to print.

    Seems easy hmmm not to me... Unfortunately.

    If this cannot be done is is it possible to have page 10 selected in the dialog box for normal printing on a button... which brings up the print dialog box and all you have to do is select the number of copies.

    Thanks in advance

    Stephen

    You can use this code to do this:

    var copies = Number(app.response("How many times do you want to print page 10?","",""));
    if (!isNaN(copies) && copies>0) {
        var pp = this.getPrintParams();
        pp.firstPage = 9;
        pp.lastPage = 9;
        pp.NumCopies = copies;
        this.print(pp);
    }
    
  • Retrieve the values of the executable (Dialog.Ask)

    Hello world!

    I have a situation where I have to ask the user a question according to the status of a remote object (sent to a web service).  This operation is performed within a Thread, so I can't directly use the Dialog.Ask () because it translates into the exception "Engine UI consulted without holding the lock of the event".  I used this code sample to get the dialog to the user

            synchronized(UiApplication.getEventLock()) {            Runnable push = new Runnable() {
    
                    public void run() {                    Dialog.ask(message, choices, 0);                }
    
                };
    
                UiApplication.getUiApplication().invokeLater(push);        }
    

    This work is nice, but I can't retrieve the result... And because it's in a thread, I don't know how I could get it... Can someone help me with this one?

    Thank you!

    You usually use

    Synchronized (UiApplication.getEventLock ())

    or

    UiApplication.getUiApplication (.invokeLater)

    There's no value in using both at the same time.

    In this case, the Dialog.ask returns an int, that indicates the result.  The doc of the API:

    Returns:
    The selection of your choice (not the index) value, as must be returned by getSelectedValue(). For example, CANCEL, OK or DELETE are among the possible return values.

    Thus, you can code something like:

    int i = Dialog.ask (...);

    Treat the i then returned.

    Without doubt, you actually want to return the result in your calling Thread.  I don't know how "legal", it is, but you might be able to get away with:

    selectedChoice int = - 1;

    {Synchronized (UiApplication.getEventLock ())}
    selectedChoice = Dialog.ask (.);

    }

    If you can't do that, then look to split the treatment at the time of questions and using a DialogClosedListener to the decision of the user process.  I don't know there are other options, just of can't think right now.

  • Does anyone know how to change the culmination of auto from 'no' to 'yes' in dialog.ask?

    No big deal here, I want to just my 'Yes' button, highlighted initially instead of the 'no' in the dialog.ask function. Anyone know how to change it? Thank you!

    Something like that?

    int choice = Dialog.ask (Dialog.D_YES_NO, "You want to stop downloading?", Dialog.NO);

  • Dialog.ask () do not work?

    Hi all

    I called Dialog.ask (Dialog.D_YES_NO, "text") in class A that extern class Thread.

    I debuged and he ran on this line but the dialog box occur and my program is suspended.

    but Dialog.ask (Dialog.D_YES_NO, "text") work well when she called in the class screen extern class.

    No matter what suggesstion, thank you!

    I think that you must synchronize the lock of the event when calling Dialog.ask

    public class A extends Thread{
        public void run(){
            ...
            synchronized(UiApplication.getEventLock()){
                 Dialog.ask(...);
            }
            ...
        }
    
    }
    
  • Need help Dialog.Ask

    Hello

    How can I get the value of the button clicked the dialog.ask that I tried with the following code, but it is retruning-1.

    Here is the code I tried

    result int = Dialog.ask (Dialog.D_YES_NO, "you do not have an open account, you want to create a?");    . Can someone help me with the code snippet.

    Thank you

    Sujithravindran

    follow these steps:

    Dialog d = new Dialog(Dialog.D_YES_NO,
                            "You don't have an Account open, would you like to create one?",
                            1,
                            null,
                            Manager.USE_ALL_WIDTH);
                    int i = d.doModal();
    
                    if (i == Dialog .YES)
                    {
                        //do something positive ehre
                    }
                    else
                    {
                           //do something ehre
                    }
    
  • Call Dialog.ask in the Thread Run method

    "in I want to call Dialog.alert and using following code but its exception to throw the wire.

    "Exception occurs java.lang.RuntimeException: pushModalScreen called by a thread of non-event."

    synchronized (Application.getEventLock ())

    {

    if (Dialog.ask ("catalog is obsolete. You want to keep it? ", choices, select, select [0])(==1)"

    {

    Run the required functionality

    }

    }

    pls help me

    I keep saying this, so forgive me of repeating myself, but:

    synchronized (Application.getEventLock ()) {}

    should only be used when nothing else will work for you or you make a very simple, very fast UI update.

    A Dialog.ask is not very fast!

    In this case, you have several options, but the most obvious solution is to ask the question before starting the Thread.  So, if that is your treatment

    Thread catUpdateThread = new Thread() {}

    public void run() {}

    Dialog.ask (...)

    Other treatments

    }

    }

    catUpdateThread.start ();

    What should do the same and works OK. :

    UiApplication.getUiApplication.invokelater (new Runnable() {}

    public void run() {}

    Dialog.ask (...)

    If (result == Yes) {}

    Thread catUpdateThread =...;

    catUpdateThread... Start();

    }

    }

    });

  • Why "limit maximum instances of this event in the queue" in the dialog box change events?

    Why I "would limit the maximum instances of this event in the queue" in the dialog box change events?

    I think that this is new for LV 2014, but I couldn't find an explanation for an instance of good use. A research on OR displays only the 2014 help text, which explains what it does, but not why?

    Does anyone know good arguments to use this option?

    Thanks in advance.

    Justin Tyme

    It is useful for user interface elements that can enqueue actions as quickly as they can be made.

    For example, say it takes takes 1 second to take a picture and save it. The user presses the button "Take a photo", but they do not see a new image file again after a wait of 250 ms (human beings humans can be impatient) so they press twice. Finally, they see a new file image... and then another... and then another... To get rid of this possibility, check this box.

    Or that you have a cursor to adjust some settings. Moving the cursor updates very fast! If the user swipes from 0 to 1 then the program might try to send all the rest as a parameter to your instrument, which takes some time. Instead of sending all of these values, it is probably better if the software can keep up with the cursor and send a value of about 1 at the same time, the cursor said 1. If you do not check this box, the user can be 1, but the unit will continue to receive values from 0.53, 0.54, 0.55...

  • Retrieve the value of Dialog.ask

    I am trying to write a function that will create a context menu using Dialog.ask and return the result of the dialog box to the calling Thread.  So far I have somethings like this:

    //display a pop-up "Yes or No" box and return true for yes, false for no
    public boolean ask(final String question){
        UiApplication.getUiApplication().invokeLater (new Runnable(){
                                                          public void run(){
                                                              int answer = Dialog.ask(Dialog.D_YES_NO, question, Dialog.NO);
                                                              if(answer == Dialog.YES){
                                                                  //somehow return true                                                          }
                                                              else{
                                                                  //somehow return false                                                          }
                                                       }});
    }
    

    I've seen a similar thread, but I didn't know how to use the solution.

    http://supportforums.BlackBerry.com/T5/Java-development/getting-values-back-from-runnable-dialog-ask...

    In short, how to use DialogClosedListener to retrieve the value of Dialog.ask to ?

    First of all, you probably want to use invokeAndWait so that the calling thread is blocked until the Runnable.run () ends. After that, one solution is to store the result of somewhere. For example, the subclass of the floor and add a field where you store the value (a more general concept of an executable that can return a value in J2SE is the future, but it is not available out of the box in J2ME). Once completed invokeAndWait, you can read this field. Alternatively, you may return the value by changing something in the outer class (one that contstructs the Runnable). For example,.

    final int[] result = new int[1];
    UiApplication.getUiApplication().invokeAndWait(new Runnable() {
      public void run() {
        result[0] = Dialog.ask(...);
      }
    });
    
    int choice = result[0];
    ...
    
  • Prevent a Dialog.ask beeing scrolled down on the launch

    Hello!

    I want to show a EULA (very long chain) in a Dialog.ask, but it scrolls down to the buttons when it is released. Is there a simple way to avoid that I can't find?

    Thank you!

    only focusable components allow to scroll.

    I had a similar problem while displaying a EULA. on top, it was very long, and the formatting is complex.

    I opted for the EULA, including in html format.

    in my UI I show accept, refuse, and display buttons.

    show the button opens the html code in the browser - with all the formatting done automatically.

    nobody reads the EULA anyway, and let the user scroll through miles of text if it does not intend to read is bad design.

  • "On Mac, I want to return to the dialog box asking"Hide Photoshop or hide"Extra"

    Hi, Merry Christmas

    I got a dialog box when I press Cmd-H, and I decided that to hide Extra.

    I want to see the dialog box again, and it's only for the first time.

    I have reset my keyboard shortcuts and based on dialog boxes reset all the warning in the preference menu, but it does not seem

    To be precise, I ask not how to change his behavior when I press H command.

    I know how to change int menu keyboard shortcuts.

    I just want to see the dialog box again.

    Thanks in advance

    I think that you need to reset the preferences of cc of photoshop by pressing the Shift + Cmd + Option, then start photoshop cc, hold down the keys until the

    you see the dialog box asking if you want to delete the file from photoshop settings and press Yes.

    Then you should see this dialog box after pressing Cmd + M, but only once you see the dialog box until that reset you the preferences of photoshop cc again.

  • [JS CS5] problem with memory leak possible with the dialog box in the event handler

    Hello

    I'm having a very difficult problem.

    I am attaching a script in a handler for a menu item, by using an installation script menu that I wrote based on one by Marc Autret. My version of the script menu installation attach a bunch of event handlers at the same time, to the actions of different menu.

    What is the event handler, with that I have a problem is to prompt the user for a URL and then applies the URL as a hyperlink to the text selection, with our house style for the way in which the URL should look like.

    The problem is the following:

    1. all other installed menu actions work very well, except for this one.

    2. the addition of URL script works fine, when you run it directly from the script menu.

    3. the combination of #1 and #2 (using the script to add URL by function as an event handler in the Edit menu) blocks to InDesign. But it is only after the addition of URL script has finished and done what it was supposed to do!

    4. when I comment on the section of the script URL adding user input, so that instead of saying

    userInput = myDisplayDialog();
    

    It is said

    userInput = "http://thisworks.com";   // userInput = myDisplayDialog();
    

    It works well as an event handler.

    So obviously a problem with the dialog box, but only when adding URL script is executed as an event handler. My first guess is that this is some kind of memory leak, but I think I am following the model of. destroy() the way I saw it elsewhere.

    Someone knows something like that before?

    I can provide all relevant if necessary scripts, but they are quite complicated. The most important of them is the input of the user function. Here it is:

    var myDisplayDialog = function( defaultText ) {
      
        var defaultText = defaultText || "";
        
        var myDialog = app.dialogs.add({
            name: "Type in a URL"
        });
        
        var myOuterColumns = [];
        var myInnerColumns = [];
        var myOuterRows = [];
        var myBorderPanels = [];
        var myTextEditboxes = [];
        var myInput;
        
        myOuterColumns[0] = myDialog.dialogColumns.add();
        myOuterRows[0] = myOuterColumns[0].dialogRows.add();
    
    
        myBorderPanels[0] = myOuterRows[0].borderPanels.add();
        myInnerColumns[0] = myBorderPanels[0].dialogColumns.add();
        myInnerColumns[0].staticTexts.add({
            staticLabel: "URL:"
        });
        
        myInnerColumns[1] = myBorderPanels[0].dialogColumns.add();
            
        myTextEditboxes[0] = myInnerColumns[1].textEditboxes.add({
             minWidth: 300,
             editContents: defaultText ? defaultText : "http://"
        });
        
        var myResult = myDialog.show();
        var myInput = myTextEditboxes[0].editContents;
        
        myDialog.destroy();
    
        if (myResult == false) {
              exit();
        }
        
        return myInput;
    
    }
    
    

    Hi Richard,

    Unfortunately, there is no guarantee that the ScriptUI longer work.

    Thake a peek here: http://forums.adobe.com/message/2881364

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

  • Problem with dismissing the dialog box

    Hello world

    This is my first post here. Sorry if the question is very simple...

    I need to download an image on server. I display a dialog box to confirm if the file should be downloaded.

    Everything works well except that the dialog box is dismissed after that the whole process is over. I know I'm missing something-related threads. pls help me to understand.

    Here is my code:

    public void fieldChanged(Field f, int context) {
        if (f == addButton) {
                        FileSelectorPopupScreen fps = new   FileSelectorPopupScreen();
            fps.pickFile();
            theFile = fps.getFile();
    
            if (theFile == null) {
                Dialog.alert("Screen was dismissed.  No file was selected.");
            }
            else {
                UiApplication.getUiApplication().invokeAndWait (new  Runnable(){
                public void run(){
                    int confirmationResult = Dialog.ask(Dialog.D_YES_NO, "Do you                    want to upload?", Dialog.YES);
                    if (confirmationResult==Dialog.YES) {
                             status=1;
                    } else {
                             status=0;
                    }
                }
              });
    
            }
    
            if(status==1){
                Thread t= new Thread(){
                    public void run(){
                        //MY CALL TO WEBSERVICE                     }
                }};
    
                try{
                    t.start();
                    t.join();                                           refreshData(); //call to method to post the image data to server                        //and refresh the screen with new image
                }
                catch(Exception e){
    
                }
    
                }
            }
    
        }
    

    My problem is that the I selected YES the dialog box only after the call to webservice licensees are completed and the image is published on the server and the screen is refreshed with the new image.

    Let me know what I'm missing.

    Welcome to the forum!

    Correctly, you start the process of network on a separate Thread.  Then you attach the wire event for this Thread by using the following instructions:

    t.Start ();
    t.Join ();

    So you give up the thread of events not until your networking activity has finished.  It does not block your event feed so that your application will become unresponsive to the user and as you noted, activities requiring feed event, such as the removal of your dialog box, cannot occur.

    You must reprogram your treatment so that the activity of the network as a completely asynchronous operation.  You can't wait on this.  You should get to tell you when it has finished.  I suggest that looking at the observer model during the implementation of this process.

  • R12.2.4 data lost after using the dialog Page and return to the calling page. (Help please!)

    Hi team,

    I'm new to OAF and works on a requirement to add some custom validation when the user clicks a button in a seeded standard page.

    The approach I took was to extend the seeded controller object managed this press event button and put my custom logic in the extended controller and substitute the standard controller through customization.

    The standard rate which was pressing the Complete button A Page, the user was taken to the next and epepinee page (Page B) some operations based on records that have been chosen Page A.

    Part of the custom validation requirement that was if some postings were not met, the user must be a pop-up asking if they really wanted to move forward and if they have selected Yes then continue with the seeded standard flow (transition to page B) and if they have NOT selected then just remain on the current page.

    I have used OADialogPage and to do this, in part, the question , I am running into is that when the user selects one or more records using a check box in a region of several record (table) and click the full page and if the validation fails then a modal page and the user made a selection i.e.either Yes or no modal page and when they return to the calling page (ex. Page A), all data (records) they chose previously is lost (the Page is refreshed). Based on what I see on this forum, I suspect it's because after having click Yes on the modal page and then return to the original page the processRequest fires again and the VO data is queried again and has all the parts on the page are lost. Since I am changing the flow in seedlings pages based on the intervention of the user I'm confused as to how this problem can be solved. that is, prevent the page refreshes or preserve the selections that were made before you navigate to modal page. Any help is really appreciated!

    My Code:

    ' Public Sub processFormRequest (OAPageContext oapagecontext, OAWebBean oawebbean)

    ...

    ...

    If (oapagecontext.getParameter ("completeOps")! = null) {}

    ...

    ...

    If (warnCount > 0) {}

    OAException message = new OAException ("not in order...", OAException.WARNING);

    oapagecontext.putDialogMessage (message);

    OAException message = new OAException ("XYZ Violated rule. Do you want to continue? ", OAException.WARNING);

    DialogPage OADialogPage = new OADialogPage (OAException.WARNING, message, null, "","");

    String Yes = oapagecontext.getMessage ("AK", "FWK_TBX_T_YES", null);

    String number = oapagecontext.getMessage ("AK", "FWK_TBX_T_NO", null);

    dialogPage.setOkButtonItemName ("ConYesButton");

    dialogPage.setNoButtonItemName ("ConNoButton");

    dialogPage.setOkButtonToPost (true);

    dialogPage.setNoButtonToPost (true);

    dialogPage.setPostToCallingPage (true);

    dialogPage.setOkButtonLabel (yes);

    dialogPage.setNoButtonLabel (no);

    oapagecontext.redirectToDialogPage (dialogPage);

    }

    If (oapagecontext.getParameter ("ConYesButton")! = null) {}

    Write Yes button Action code

    oapagecontext.putParameter ("completeOps", "Continue");

    }

    If (oapagecontext.getParameter ("ConNoButton")! = null) {}

    Write the code of the Action for the No button

    Dim errormsg = ' rule Violations have occurred. "

    throw new OAException (errormsg);

    }

    super.processFormRequest (oapagecontext, oawebbean);

    }

    I managed to work around this problem by adding a simple control in my controller processRequest method extended to avoid the call to super.processRequest incase lhen control returns to the page once the user has made a selection on the Page of the dialog box

    If ((oapagecontext. (GetParameter ("ConYesButton") == null) & (oapagecontext.getParameter ("ConNoButton") == null)) {}

    super.processRequest (oapagecontext, oawebbean);


    }


    Thank you!

Maybe you are looking for

  • Tecra Z50-A-12V-key fell

    Hello Unfortunately the letter S is detached from the keyboard of my laptop. The plastic caps came out with it and are still attached to the button. After some research on the internet and looking well, I saw that the metal hooks for plastic housing

  • My HPDeskjetF4280 connects to the computer while he was offline.

    My computor updated last night and now it won't find my printer, it is an older one and is connected with a cable and I think that the computer is looking for a Wi - Fi connection. He has done it before and I've always been able to get turned back on

  • WARNING: Incompatible Arg. You can't use stack Variables If generating series is not defined

    What does this message mean? "WARNING: incompatible Arg. you can't use stack Variables If generating series is undefined." Where can I put generate series only? Thank you Derek

  • 5.9 amp running on P70530 stepper engine

    I have a P70530 drive which is capable to provide 5a. I have a stepper motor with a current RMS of 5.9. I might damage the engine is I underamp he? Or he will limit all of the available torque?

  • H9-1080uk new for ME - no sound

    Hello I just bought a 1080uk h9 for ME (Windows 7 64-bit) and set up, everything works fine, but I'm having a problem with the audio. I don't have speakers, I tried to update the sound card drivers, followed all the help Windows and HP files, made so