PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

Connecting Signals | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

To react to a signal you must connect to it by specifying a callback function for PHP-GTK to call when that signal is emitted.

Connecting a function to a signal is achieved by calling the connect() method of the object.

The function that you register as the callback for a signal must have the correct prototype. You can find what the prototype should be from the reference section of this manual.

For example, if you wanted to connect to the "clicked" signal of an instance of GtkButton you should define a function that accepts one parameter, which will be the button that was clicked.

The code below shows how you might create a window, add a button to it, wait for it to be clicked and then, when it is clicked, open a new GtkWindow containing a message.

The important part here is where we call $button->connect(); The connect method here registers the you_clicked() function as the callback that will be invoked when the "clicked" signal is emitted by the GtkButton widget. We also register the shutdown() function as the handler for the "destroy" signal for both windows so that we can shut down the application properly.

忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「Connecting Signals」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | Connecting Signals」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: