Code:
{curl 8.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{applet manifest = "manifest.mcurl",
{compiler-directives careful? = true}
}
{import * from CURL.ENGINE.BROWSER}
|| AppletData
{define-class public ChildAppletData {inherits AppletData}
{constructor public {default
ag:#AppletGraphic,
u:Url
}
{construct-super ag, u}
}
}
{def child = {ChildAppletData null, {url "child.curl"}}}
{View
|| この{Frame}を置き換えて使用してください
{Frame width = 8cm, height = 8cm
,{VBox
spacing = 2pt
,{spaced-hbox
{CommandButton
label = "start",
{on Action do
{child.applet-invoke-async
finish-proc = {proc {ex:#Exception, result:any}:void},
"start"
}
}
},
{CommandButton
label = "stop",
{on Action do
{child.applet-invoke-async
finish-proc = {proc {ex:#Exception, result:any}:void},
"stop"
}
}
},
{CommandButton
label = "change string",
{on Action do
{child.applet-invoke-async
finish-proc =
{proc {ex:#Exception, result:any}:void
{if-non-null ex then
{popup-message "Error! " & ex}
}
},
"change-displayed-string", "abc"
}
}
}
}
}
},
visibility = "normal",
{on WindowClose do
{exit}
}
}
Code:
{curl 8.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{applet manifest = "manifest.mcurl",
{compiler-directives careful? = true}
}
{define-class public Child
field displayed-string:String
field private timer:Timer
{constructor public {default}
set self.displayed-string = "child"
set self.timer =
{Timer
enabled? = false,
interval = 1s,
{on TimerEvent do
{output self.displayed-string}
}
}
}
{method public {start}:void
{self.timer.enable}
}
{method public {change-displayed-string str:String}:void
set self.displayed-string = str
}
{method public {stop}:void
{self.timer.disable}
}
}
{{get-the-applet}.register-applet-invoke-handler
{Applet.applet-invoke-handler-for-object {Child}},
verifier = {proc {}:bool {return true}}
}