|
||||||
| PHP Tutorials PHP Tutorials |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
||||
|
Beginning PHP-GTK: Signals
Before you begin... You should know that this tutorial builds off the first tutorial here. You should understand everything in that tutorial before continuing with this tutorial. Introduction to "Beginning PHP-GTK Part 2" In the last part of this series tutorial you created a basic GUI interface using PHP-GTK. At the end of the tutorial, the application we made looked like this: ![]() If you don't have the code, go back and fetch it. We will be using that code during this tutorial. Signals Signals are notifications fired by the user or internal coding. The PHP-GTK manual puts it best: Quote:
Signal Callback Functions In order to react to a signal, it must be connected to a callback function. A callback function is any PHP function or class method. You connect a signal to a function using connect(). Constructor: Code:
int connect(string signal, string function, [mixed custom_data ]); function: Name of the function (callback) to be called custom_data: optional, used to pass extra data to the callback function (such as params) Connecting a signal is easy. First, lets create a stop and start button method. In the CodeCallGtk class, add these methods: PHP Code:
Connecting the Signal As mentioned earlier, connecting the signal is done with connect(). There is also connect_after(), connect_object() and connect_object_after but they are beyond the scope of this tutorial. In the __construct() of CodeCallGtk (before show_all()), connect the buttons "clicked" signal with the functions we added earlier: PHP Code:
PHP Code:
![]() Clicking the Start button currently does nothing. Part 2 Conclusion This was a very simple tutorial covering only signals in PHP-GTK. Signals are important because they allow you, the PHP-GTK programmer, to react to user events. Without them, event based GUIs such as this one would be useless. << Previous Part 1 | Continue to Part 3 >> ------
__________________
Questions and Answers | Online News and Social Bookmarking | Code and Text Collaboration General Chat Forum Last edited by Jordan; 07-17-2009 at 07:48 AM.. |
|
||||
|
Re: Beginning PHP-GTK: Signals
Your making these too fast! lol I have not even gotten to the first one yet
![]()
__________________
![]() Google - I'm Feeling Lucky | Youtube Classes! My Portfolio | Email Me | QuestionBin |
|
||||
|
Re: Beginning PHP-GTK: Signals
Part 3 probably will not come out until later next week so you have some time.
![]()
__________________
Questions and Answers | Online News and Social Bookmarking | Code and Text Collaboration General Chat Forum |
|
||||
|
Re: Beginning PHP-GTK: Signals
Whoops. Yup. Thanks. Fixed!
__________________
Questions and Answers | Online News and Social Bookmarking | Code and Text Collaboration General Chat Forum |
![]() |
| Tags |
| gtk, gui, php, php-gtk |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 09:57 AM.
Amrosama.cc
Arekbulski.cc
Debtboy.cc
Guest.cc
Jaan.cc
James.cc
Mathx.cc
Tsz.cc
Vswe.cc