2 Replies Latest reply on Sep 23, 2015 4:35 AM by Suntanned

    How to affect a PageItem within an OnClick handler

    Suntanned

      Hi,

       

      I'm trying to set the geometricBounds of a PageItem and that works fine until I do it within a button click handler, then nothing happens.

       

      Code:

       

      function createDialog(header, message, pageItem) {
           var dialog = new Window("dialog", header),
                textArea = dialog.add("statictext {preferredSize: [200, 100], properties: {multiline: true}}"),
                correctButton = dialog.add("button", undefined, "Correct");
           
           textArea.text = message;
           
           correctButton.onClick = function() {
                alert('Before');
                pageItem.geometricBounds = [1, 1, 8, 8];
                alert('After');
           }
           
           dialog.show()
      }

       

      Also, only the first alert pops up. 'After' is never shown.

       

      Any ideas?