Thread Rating:
  • 294 Vote(s) - 2.57 Average
  • 1
  • 2
  • 3
  • 4
  • 5
独立型アプレットでのサブアプレット
11-02-2014, 11:55 PM, (This post was last modified: 11-02-2014, 11:58 PM by nitakanworld.)
#1
独立型アプレットでのサブアプレット
はじめまして、Curlを勉強中です。

Webブラウザを使わないで動作する独立型アプレットでツールを作ろうと思っています。
バックグラウンドで定期的に処理を行いたいのですが、
サブアプレット用のクラスメソッドを上手く呼ぶことができません。
特にエラーもなく、何処が原因かわからないのでアドバイスお願いします。

参考にしたページは以下です。
http://developers.curlap.com/re-referenc...groud.html
http://developers.curlap.com/curl/docs/c...cript.html

独立型アプレットではサブアプレットは作れないのでしょうか・・・?
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}}
}


Forum Jump:


Users browsing this thread:
2 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')