How to freeze my application until the dialog box is closed?

Hi everyone, I wonder how to freeze my application until the dialog box is closed.

Please look at my code first:

inputDialog=new InputReadMessageNumberDialog(selectedGroup.getName(),msg,numPost,choices,values);
UiApplication.getUiApplication().invokeLater(new Runnable()
{
  public void run()
  {
   inputDialog.show();
   if(inputDialog.doModal()==Dialog.OK){
   System.out.println("FROM: " + inputDialog.getFrom()+" TO:"+inputDialog.getTo());
   }
  }
});

As I throw the runtime exception, then I tried to do this:

inputDialog=new InputReadMessageNumberDialog(selectedGroup.getName(),msg,numPost,choices,values);
UiApplication.getUiApplication().invokeLater(new Runnable()
{
  public void run()
  {
   inputDialog.show();

  }
});while(true){  synchronized(this){    if(inputDialog.isClosed) break;    else wait(500);  }}if(inputDialog.doModal()==Dialog.OK){
System.out.println("FROM: " + inputDialog.getFrom()+" TO:"+inputDialog.getTo());
}

She also throws an exception too. Now I don't know how to solve this problem.

Any ideas?

Thank you!

Steve

While I have deep religious convictions against the complicity of an author of the modal dialog box,

I can say that this code seems to work and these dialog box classes are easy to use. If you

Look at the API these altneratives will be pretty obvious.

but there are two usages mixed with a be commented (both

Work as much as I KNOW).

String [] ch = new String() {"ACCEPT", "REJECT"};
int [] vx is new int [] {Dialog.YES, Dialog.NO};.
D = new dialog box dialog (m_tc, ch, vx, vx [0], new Bitmap (1,1));
       
D = new dialog box dialog box (Dialog.D_YES_NO, m_tc, Dialog.NO, Bitmap (1,1), 0) new;
F = d.getFont (police);
d.setFont (f.derive (Font.PLAIN, f.getHeight () - 1));
int x = d.doModal ();

This will block your thread until there is something to "xx."

However, I must reiterate that you evaluate the options before deciding that you need

to lock all the other options. This is especially true in this environment where things

might take some time and resources are limited.

If you want to hang your entire application, no doubt you

can define a volatile indicator around the doModal call and have other threads check it.

Tags: BlackBerry Developers

Similar Questions

  • How to use a button in a dialog box without closing the dialog box

    I defined a button located in a dialog box. I want this button to refresh an outputText but when clicked, the managed bean method is called as expected and the dialog box is closed that I don't want.

    <af:popup id="dataFilterPopup">
      <af:dialog id="d5" contentHeight="500" contentWidth="600" stretchChildren="first">
      <af:panelGroupLayout layout="vertical">
      <af:commandButton text="Count" id="cb1" action="#{pageFlowScope.ReportDataFilterBean.count}" partialSubmit="true" partialTriggers="countText"/>
      <af:outputText id="countText" clientComponent="true" value="Number: #{pageFlowScope.ReporDataFilterBean.countValue}"/>
      </af:panelGroupLayout>
      </af:dialog>
    </af:popup>
    

    The managed bean counting method sets the value of the countValue.

    public void count() {
     countValue = 10;
    }
    
    public int getCountValue() {
      return countValue;
    } 
    

    I see two errors:

    1. you may use the 'action' of attribute because it causes the navigation there is no transition rule such that the current page is just refreshed, so your dialog box is closed. Use 'actionListener' rather;

    2. in order to refresh the component, you must set the 'partialTriggers' attribute but not the attribute 'partialTriggers' the command button:

    Dimitar

  • How to use metric units in the dialog box layout?

    When I go to my layout in the margins tabs dialog box I see that I can specify the margins in inches. However, in my friends PC, I saw Page Setup dialog boxes that use millimeter to manage margins.

    How can I make my version of Firefox to use millimeters instead of inches? Using this unit dark is annoying for me. I prefer to use the metric unit internationally accepted.

    You can look at the code here to see if this gives some possible things to try:

  • Retrieve the value of the dialog box

    Hello

    I have a class that extends the dialog box. A few Radiobuttns are added. I want to get the value of the RadioButton selected the actual class of the screen, call the dialog box by clicking the Dialog.OK button. The code I tried is as follows:

    My class of the screen:

                    XXXDialog clScrn = new XXXDialog ();
                    if (clScrn.doModal() == Dialog.OK) {
    
                        // I click Ok, but this is never shown
                        Dialog.alert("Closed & here");
                        Dialog.alert("Selected = " + clScrn.getSelectedItem());
                    }
                    clScrn = null;
    

    The dialog class-

      public XXXDialog() {
            super(Dialog.D_OK, "Select Item", Dialog.OK, null, VERTICAL_SCROLL | VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT);
            rbg = new RadioButtonGroup();
            rb1 = new RadioButtonField("One", rbg, false, Field.USE_ALL_WIDTH);
            rb2 = new RadioButtonField("Two", rbg, false, Field.USE_ALL_WIDTH);
    
            rb1.setChangeListener(this);
            rb2.setChangeListener(this);
    
            add(rb1);
            add(rb2);
        }
    
        public void fieldChanged(Field f, int context) {
    /*
    Actually, I want to know which field was clicked RadioButton or Ok button. If it is Ok, then I want to hide and return back to screen.
    */
    
            try {
                    RadioButtonField fd = (RadioButtonField) f;
                    item = fd.getLabel();
                    System.out.println("Selected = " + item);
            } catch (Exception e) {
            }
    
            try{
                ButtonField fd = (ButtonField) f;
                System.out.println("********* Button PRESSED = " + f);
                this.close();
            } catch (Exception e) {
            }
    
            System.out.println("*********** Field Count = " + f.getManager().getFieldCount() + " Index = " + f.getIndex());
        }
    
        public String getSelectedItem() {
            return item;
        }
    

    The XXXDialog class is in a separate file of java.

    Can anyone help me on what to do and how to achieve the goal.

    Thank you

    I found my solution. What I did is: -.

    In my main screen, I call the as dialog box

    clScrn.doModal ();

    Dialog.Alert (Come Back here");   I see this alert as soon as the dialog box is closed.

    In my class of dialogue, I have only the Ok button, dialog can be closed using the ESC key as I implemetned the code-

    Dialog box does not close on ESC
    {} public boolean keyChar (key char, int status, int time)
    Boolean retVal = false;
    {Switch (Key)}
    case Characters.ESCAPE:
    break;
    }
    Return retVal;
    }

    So now, there is no other means to close the exception, Ok button dialog box and I make sure that when Ok is clicked, 1 radiobutton is selected.

    Thank you all for the time and effort.

  • How can I listen to a modal dialog box?

    I open a bunch of files and every 500 or if I have a modal dialog box that opens. Some of these files are 10 years old so the fonts are retired etc.. Is there a way to detect if a modal dialog box is displayed when a file is opened? If so is it also a way to delay the next iteration of the loop until the dialog box has been addressed, but still have the never value userInteractionLevel?

    It would be interesting to know what kind of dialogue still appears. Missing links and missing fonts are removed, I know for certain. Don't know what else could be wrong during the open file. Trying to open a newer version may be, for example try to open a file of CS6 in CS5?

    Peter

  • [CS3 - Win] - Auto cancelled the dialog box

    Hello

    I have to cancel my Modal dialog box move after a few minutes (applying the UserCancelled() function automatically).

    Try this code:

    Application InterfacePtr < IApplication > (gSession-> QueryApplication());
    InterfacePtr < IDialogMgr > dialogMgr (application UseDefaultIID());

    InterfacePtr < ICommand > closeDialogCmd (CmdUtils::CreateCommand(kCloseDialogCmdBoss));)
    CloseWinData InterfacePtr < ICloseWinCmdData > (closeDialogCmd, IID_ICLOSEWINCMDDATA);
    closeWinData-> Set (dialogMgr-> GetFrontmostDialogWindow());
    CmdUtils::ProcessCommand (closeDialogCmd);

    Result: the dialog box is closed, but I don't have access to the application.

    Do you have any idea, please.

    Best regards
    BADR

    Hi Badr,

    If you just want to call UserCancelled() on the foreground dialog box, you can try this:

    InterfacePtr application (gSession-> QueryApplication());
    InterfacePtr dialogMgr (application UseDefaultIID());
    InterfacePtr window (dialogMgr-> GetFrontmostDialogWindow (), UseDefaultIID ());
    InterfacePtr panelCtrlData (window, UseDefaultIID ());
    IControlView * iCtrlView = panelCtrlData-> FindWidget (kCancelButton_WidgetID);
    InterfacePtr iiSubject (iCtrlView, IID_ISUBJECT);
    If (iiSubject)
    iiSubject-> Exchange (kTrueStateMessage, IID_IBOOLEANCONTROLDATA);

    HTH.

    Kind regards
    Jasmine Shaikh

  • After closing the dialog box screen, menu by default is displayed

    I have a simple program that consists of a screen and a button. When the button is clicked, it displays a dialog box in the button handler. Once the dialog box is closed, the parts of the menu are displayed. Very strange.

    Here's the code that displays the dialog box:

    public void fieldChanged( Field field, int context )
        {
            String label = "";
    
            if ( field instanceof ButtonField )
            {
                label = ((ButtonField)field).getLabel();
            }
    
            //if this was the login button, display the popup.
            if ( label.equalsIgnoreCase( "Login" ) )
            {
                String icon = "questionmark.png";
                Bitmap bitmap = Bitmap.getBitmapResource( icon );
                String [] options = new String [] { "Yes", "No", "Cancel" };
                int [] optionIndexes = new int [] { Dialog.YES, Dialog.NO, Dialog.CANCEL };
                Dialog dialog = new Dialog( "Select an option", options, optionIndexes, optionIndexes[2], bitmap );
                dialog.doModal();
    
            }
    
        }
    

    Once the dialog box is closed, this is:

    I have no idea why this show after the closure of the dialog box. Any ideas?

    Well done

    I think that many people would find answers to their questions if they tried harder with search.  And you find faster as well!  And whenver I creative search, I usually find something else useful that I was looking for.  Kind of like Google where you can go off on a complete tangent...

    In any case, can mark you this as resolved?  See you soon

  • How to hide the 'Network' icon in the dialog box "save in".

    Hello

    I use the service of Windows 2008 server TS, I would appreciate if you can let me know how I can hide the 'Network' icon under "save in" option in the dialog box "save under" in various applications please, e, g, Notepad or MS Office 2003. Thank you

    Best regards
    William

    Hi William golfer.

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the TechNet forums.

    http://social.technet.Microsoft.com/forums/en-us/winserverGP/threads

  • MS Photo Gallery, how can I activate the "do not show this again" when the dialog box appears whenever I try to download a picture to another location?

    How can I activate the "do not show this again" when the dialog box appears whenever I try to download a picture to another location?

    The dialog box that appears frequently when I try to convert or download photos, shows the shadow of this question - I want to make it active until the times dialog box stops appearing I scroll the photo folders.

    Thank you

    I got the last part of what you wanted, which was simply not the message

    The key is that you have to allow this program through your windows firewall.

    Go to your look for the windows Firewall Control Panel,

    There should be a list to allow a program through windows firewall, look at the top left.

    If you feel safe doing this, vlc is not one that I would feel safe with, but to you, it has a function to browse to find the program to be added to your trusted list or access through your firewall.

    Still, it may give you a warning but could release the message?

  • When you delete a file in Vista, the dialog box remove does not close until the computer is restarted

    When you delete a file in Windows Vista, the dialog box remove don't close until the computer is restarted. It is sometimes possible to remove it by closing tha task list. When this is done, the Explorer is closed and restarted.

    Hi Brian,.

    (1) since when are you facing this problem?

    (2) remember to make changes?

    Method 1: Run the fixit available in the link below and check if that makes a difference

    Difficulty of broken desktop shortcuts and common system maintenance tasks


    Note:
    Fixit would attempt to recover bad sectors on the hard disk, in the course of this process there are chances of data loss from that particular area.

    Method 2: If a Protection of resources Windows (WRP) file is missing or is damaged, Windows may not behave as expected. Auditor of file system (CFS) scan to fix all of the corrupted system files. To do this, follow the steps mentioned in the link below:

    How to use the System File Checker tool to resolve missing or damaged on Windows Vista or Windows system files

    http://support.Microsoft.com/kb/929833

    Method 3:  Select the boot and then check if the problem persists

    Follow step 1 in the link below,
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.

  • whenever I start my windows, the dialog box appears with the words "persistence module a work stoppage" how to fix this problem?

    whenever I start my windows, the dialog box appears with the words "persistence module a work stoppage" how to fix this problem? someone help me please tell how to fix

    Hello

    1. have there been recent changes to the computer before the show?

    I suggest you to try the steps below and check if it helps.

    Method 1: Start your system in safe mode and check if the same problem occurs.

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Method 2: If the question does not exist in Mode safe mode then try to put your computer in a clean boot state.

    By setting your boot system minimum state helps determine if third-party applications or startup items are causing the problem.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or Windows 7:
    http://support.Microsoft.com/kb/929135

    Note: After the boot minimum troubleshooting step, follow step 7 in the link provided to return the computer to a Normal startup mode.

    Hope this information is useful.

  • [CC/CC2014/Mac] How to prevent the dialog box to hide

    Hi all

    I have a Connect dialog box to my plugin. When the connection is asuccess, I show an error alert box to the user. After that, when the user closes the alert dialog box, the dialog connection must still be in its place and user can try to log in again. It works absolutely fine until the CS6. But in CC2014 strange thing happens.

    When the user closes the error alert box, my connection dialog box just disappears! In fact, it becomes invisible since the closure, all options of InDesign becomes invalid as if a dialog box opens and I have to close the application with the activity monitor. I don't know why this phenomenon occurs? (I did nothing special to my Controller dialog box)

    The following simple code has worked before-

    void MyLoginDialogObserver::Update(const ClassID& theChange, ISubject* theSubject, const PMIID& protocol, void* changedBy)  {
      if (theChange == kTrueStateMessage) {
           InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());
           ASSERT(controlView);
           if (controlView) {
                WidgetID widgetID = controlView->GetWidgetID();
                switch (widgetID.Get()) {
                     case kOKButtonWidgetID: {
                        if (Login()) {
                             // login is successful
                            CDialogObserver::Update(theChange, theSubject, protocol, changedBy);
                        }else{
                             // login failed! 
                             CAlert::InformationAlert("Login Failed!");
                             //THE DIALOG SHOULD REMAIN OPEN after the alert box is closed, but it just vanishes!
                        }
                        break;
                     }
                     default : {
                          CDialogObserver::Update(theChange, theSubject, protocol, changedBy);
                          break;
                     }
                }
           }
      }
    }
    

    Any help will be very appreciated!

    Move this login()) for your DialogController::ValidateDialog ().

    BTW, your comment should invoke the Update() inherited in all cases unless it consumes a specific notification, such as a widget in private.

    And for the removal of the OK button you really should know what you're doing.

    Dirk

  • How can I replace the mime types of server, always get the mp3, rar, sid, bin files directly in the dialog box "where do you want to save this file?"

    I used to be able to click on MP3 files, the way back when, and Firefox asks where I wanted to save. Nowadays, it opens a new tab with a flash drive.
    By clicking on the "unknown" files, like .sid, .prg, .zip, .rar is ' this is a BIN file. [Cancel] [Save] ». It does not give me a check box for "always do this".
    I would like that option to edit so that certain types of files, such as PDF, regardless of mimetype, always get opened in a new tab if you click. Also some types of files, based on the extension, always go directly to the dialog box "Where you want to save the file?", without worrying if there is a viewer or a builtin player or not. In my Firefox (41.0.1 14.04LTS 32-bit Ubuntu) I have never the choice "do this for these files always" more.
    Googling led me to delete my file mimeTypes.rdf and since file extensions can even "well known", such as .zip, are treated as BIN files and I get the box Cancel-or-Save for those too - again without the choice of "always save the BIN files.

    These files are send as Content-Type: application/octet-stream and Content-Disposition: attachment;
    To send files in this way, you cannot save an automatic action.
    You can see that in network monitor.

    Content-Disposition: attachment; filename="TURRICAN_AMIGA_PORT.sid";
    Content-Type: application/octet-stream
    
  • How to add more application under the new tab shortcuts when we right click on the desktop.

    How to add more application under the new tab shortcuts when we right click on the desktop.

    Hello

    I suggest you to post your questions in the forums 'Development of the User Interface for Windows Desktop' for better assistance.

    Here is the link: http://social.msdn.microsoft.com/Forums/en-US/windowsuidevelopment/threads

  • How do to the dialog box options spelling? (e-mail)

    Using windows mail. When I use the spellchecker, I get a "this language is no longer for the spell check. "Please select another in the dialog box options spelling" message. How do to the dialog box options spelling?

    This language is no longer available for spell checking. Please select another in the Spelling Options dialog.
     

    Change it back.
     

    1. in the main window of Windows Mail, click Tools
    2. the options
    3 spelling
    4. choose a language except English
    5. apply
    6. choose English
    7. apply
     
     

Maybe you are looking for

  • Update has developed bad Bookmarks

    All was well with Firefox 11 this morning before his installation of an automatic upgrade. Now all bookmarks were lost. I tried to restore to an earlier date. Nada! The history is lost. I uninstalled and reinstalled Firefox. There is nothing. My addo

  • WPF graphics, display plot marker (with contact information tooltip) on the mouse event

    Hello I need display the coordinates of the point of the field when the mouse pointer is positioned top/close to him. I already display a ToolTip with coordinates using the code in this LINK (works equally well for graph). However, it is not easy to

  • 8007000D error code

    computer tried to install and update (KB971644) and it installs not 8007000D error code

  • RAM for Compaq Presario

    I have a compaq presario SR 1215 CL PJ506AA using Windows XP.  How much more RAM I could add to my office?  Might buy it locally?  (i.e.Best Buy or London Drugs) in British Colombia?

  • Application distribution

    Hello I think that this may be off topic for this forum. Because I couldn't find the appropriate information for what I want. -Advertising for free via my wap server application? -Do I need to obtain certification for our application to be repaired?