I need to be able to pop up a modal dialog and have it block until the user
dismisses it so I can test the return value and determine what they clicked.
It doesn't appear that laszlo modal dialogs work this way.  Is this a bug or
am I doing something wrong?  Sample code follows...



<?xml version="1.0" encoding="UTF-8" ?>
<canvas width="600" height="400" debug="true">
<debug x="25" y="280" width="400" height="25"/>

  <class name="okcanceldialog" extends="modaldialog">
    <attribute name="buttonHit"/>
    <method name="showDialog">
      this.buttonHit = "";
      this.open();
      return buttonHit;
    </method>
    <method name="ok">
      this.buttonHit = "ok";
      this.close();
    </method>
    <method name="cancel">
      this.buttonHit = "cancel";
      this.close();
    </method>
    <reverselayout axis="y" />
    <view layout="axis:x" >
      <button onclick="parent.parent.ok()" isdefault="true">OK</button>
      <button onclick="parent.parent.cancel()">Cancel</button>
    </view>
  </class>

  <okcanceldialog name="dlg">
    <text>Hello World!</text>
  </okcanceldialog>

  <button x="20" y="20" text="click me">
    <method event="onclick">
      var result = canvas.dlg.showDialog();
      Debug.write("this shouldn't print until after ok has been clicked");
      if(result == "ok") {
        Debug.write("ok clicked");
      }
    </method>
  </button>

</canvas>

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to