Thread Rating:
  • 294 Vote(s) - 2.57 Average
  • 1
  • 2
  • 3
  • 4
  • 5
独立型アプレットでのサブアプレット
11-07-2014, 11:44 AM,
#2
RE: 独立型アプレットでのサブアプレット
私の環境(Curl8.0)では、特に問題なく動き(Curlのコンソールに「child」と出力され)ました。

■parent.dcurl
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}
    }
}


■child
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}}
}



Messages In This Thread
RE: 独立型アプレットでのサブアプレット - by umemura - 11-07-2014, 11:44 AM
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1180')