Thread Rating:
  • 371 Vote(s) - 2.92 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sonntag でCommand を呼び出す
07-25-2011, 05:57 PM,
#1
Sonntag でCommand を呼び出す
Sonntag で、Command で定義した処理をイベントとして呼び出すときには、

CommandButton のなかで bind-screen-command を使えばいいのは分かったのですが、

バインドさせずに、たとえばコンストラクタのなかで呼び出す場合には、どうすればよいのでしょうか。
07-25-2011, 06:46 PM,
#2
RE: Sonntag でCommand を呼び出す
Sonntag 設計者に聞いて解決しました。

Screenクラス内で {self.do-command "コマンド名"} で実行できました。

アチョー。
07-25-2011, 09:23 PM,
#3
RE: Sonntag でCommand を呼び出す
内部的にはScreenクラスはCommandContextで、define-screen-commandで定義されるのはそのCommandImplです。do-command以外にも、CommandContextのメソッドはすべて使えます。
07-26-2011, 07:11 PM, (This post was last modified: 07-26-2011, 08:53 PM by umemura.)
#4
RE: Sonntag でCommand を呼び出す
Sonntagの設計者にも聞いてみましたが、Command に引数を渡したり、戻り値をもらったりはできないんですね。

Screen のフィールドを使って格納したり、参照したりするのが基本的スタンスという理解です。

08-02-2011, 09:24 AM,
#5
RE: Sonntag でCommand を呼び出す
Command がパラメータを扱う場合は CommandImpl.prepare や CommandImpl.prompt を正しく実装するというのがCommand 本来の作法のようです。(詳しくは CommandImpl の APIリファレンス参照)
ただし Sonntag でスクリーンコマンドを定義するための define-screen-command はこれらの実装を定義できるようになっていないため、実行時の処理の一環として Screen から値を取得したりする必要があります。


Possibly Related Threads...
Thread Author Replies Views Last Post
  Sonntag MVC without strings or name RobertShiplett 3 4,726 08-09-2011, 01:12 AM
Last Post: RobertShiplett
  Sonntag で別画面(Screen)のイベントを呼ぶ umemura 2 4,048 08-04-2011, 02:47 AM
Last Post: RobertShiplett
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('156')