BUG: Close Button Does Not Close Modeless AFC UIPropertyDialog

ID: Q201484


The information in this article applies to:


SYMPTOMS

If a Java application or applet displays a modeless Application Foundation Classes (AFC) Property Sheet dialog box, the Close button on that dialog box has no effect. You must click OK or Cancel to close the dialog box.


RESOLUTION

You can avoid this behavior if you create the Property Sheet dialog box as a modal dialog box.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

When the Property Sheet dialog box is modeless and you click the Close button, it also does not result in a call to doApplyAction(), doCancelAction(), or doOKAction().

Steps to Reproduce Behavior

  1. Enter and compile the following program:
    
          // Propertydialog.java
          import java.awt.*;
          import com.ms.ui.*;
          import com.ms.ui.event.*;
          import java.awt.event.*;
          import com.ms.fx.*;
          import java.text.*;
    
          class propertydialog extends UIFrame implements IUIActionListener
          {
    
              public static void main(String args[])
              {
                try {
                    propertydialog app = new propertydialog();
    
                   app.resize(200, 100);
                   app.show();
                }
                catch (Exception e) {
                   e.printStackTrace();
                }
              }
    
              public boolean handleEvent(Event e)
              {
                  if (e.id == Event.WINDOW_DESTROY)
                      System.exit(0);
    
                  return (super.handleEvent(e));
              }
    
              public propertydialog()
              {
                setLayout(new UIFlowLayout());
                UIPushButton pb = new
                   UIPushButton("Create PropertyDialog",UIPushButton.RAISED);
                pb.addActionListener(this);
                add(pb);
             }
    
             public void createDialog()
             {
                UIFrame frame = new UIFrame("Dialog");
                UIPropertyDialog dialog = new myDialog(frame, false);
                myPage sheet = new myPage(dialog);
    
                dialog.addPage("PropertySheet1",sheet);
                System.out.println("Displaying Property Sheet");
                Object o = dialog.display();
                System.out.println("Property sheet returned " + o);
             }
    
             public void actionPerformed(UIActionEvent event)
             {
                createDialog();
             }
    
          }
    
          class myDialog extends UIPropertyDialog
          {
             public myDialog(UIFrame f, boolean modal) {
                super(f, "UIPropertyDialog", modal, UIPropertyDialog.SMALL);
             }
    
             public boolean doApplyAction(Event e, Object o) {
                System.out.println("Doing ApplyAction");
                return true;
             }
    
             public boolean doCancelAction(Event e, Object o) {
                System.out.println("Doing CancelAction");
                return true;
             }
    
             public boolean doOKAction(Event e, Object o) {
                System.out.println("Doing OKAction");
                return true;
             }
    
          }
    
          class myPage extends UIPropertyPage
          {
             myPage(UIPropertyDialog dialog)
             {
                super(dialog);
             }
    
             public boolean isApplyable() {
                return true;
             }
    
             public boolean addContent()
             {
    
                add(new UIText("This is UIPropertySheet"));
    
                return true;
             }
          } 


  2. Run it using jview propertydialog and click Create PropertyDialog.


  3. Click the Close button on the Property Sheet dialog box.

    RESULT: It does not close.


  4. Click OK or Cancel to close the dialog box.



REFERENCES

The Application Foundation Classes are documented as part of the SDK for Java on the following Web site:

http://www.microsoft.com/java/sdk/20/afc/default.htm

UIPropertyDialog class is documented on the following Web site:

http://www.microsoft.com/java/sdk/20/packages/ui/UIPropertyDialog.htm

Additional query words: AFC, UIPropertyDialog


Keywords          : kbInternet kbJAFC kbSDKJava kbGrpJava kbSDKJava320 
Version           : WINDOWS:
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: July 9, 1999