You need to define the buttonPressed() event as follows:
function buttonPressed(button) {
p1.open(button.getWindow(), new SheetStateListener() {
sheetClosed: function(s) {
System.out.println("Sheet closed");
}
});
}
See this article for more information on implementing interfaces using
JavaScript:
http://download.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html#jsimplement
On Apr 20, 2011, at 10:52 PM, sam wrote:
> Here is a very brief bxml reproduces the error I got
>
> <Window title="Listener Demo" maximized="true"
> xmlns:bxml="http://pivot.apache.org/bxml"
> xmlns:content="org.apache.pivot.wtk.content"
> xmlns:validation="org.apache.pivot.wtk.validation"
> xmlns:util="com.pivot.util"
> xmlns="org.apache.pivot.wtk">
> <bxml:define>
> <Prompt bxml:id="p1" options="['OK', 'Cancel']"/>
> </bxml:define>
>
> <Border styles="{padding:2}">
>
> <PushButton buttonData="Click Me!">
> <buttonPressListeners>
> importPackage(org.apache.pivot.wtk);
> importClass(java.lang.System);
> function buttonPressed(button) {
> p1.open(button.getWindow(), new SheetStateListener.Adapter(){
> function sheetClosed(s){
> System.out.println("Sheet closed");
> }
> });
>
> }
> </buttonPressListeners>
> </PushButton>
>
> </Border>
> </Window>
> The error I got was
> javax.script.ScriptException:
> sun.org.mozilla.javascript.internal.EvaluatorException: invalid property id
> (<Unknown source>#6) in <Unknown source> at line number 6
>
> View this message in context: Re: Alert opened and the rest of code keep going
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.