BUG: Close Button Does Not Close Modeless AFC UIPropertyDialogID: Q201484
|
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.
You can avoid this behavior if you create the Property Sheet dialog box as a modal dialog box.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
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().
// 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;
}
}
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