An Introduction to the Winbinder Library, Part 1
(Page 2 out of 3)"Hello World"
There's no better way to demonstrate something new than using the classic "Hello World" example, so…
// Include Winbinder library
include ("D:\WinBinder\phpcode\include/winbinder.php");
// Create main window
$mainwin = wb_create_window(NULL, PopupWindow, "Hello world!", 100, 100);
// Create label control inside the window
wb_create_control($mainwin, Label, "Hello World!",
0, 25, 100, 100, 0, WBC_CENTER);
// Enter message loop
wb_main_loop();
?>
The above example will create the following window when run:
To run the above example yourself, save the code as 'helloworld.phpw', and double-click this file. You'll be most likely asked by Windows to select a program to run it with. You should run it with 'php-win.exe', located in C:\WinBinder\binaries\php4\ (this depends on where you installed WinBinder). See the installation instructions for more information.
Let's go through the example. In the first line the Winbinder library is included. In the second line the main window of the application is created using the wb_create_window() function. This function is used to create new windows, and takes several arguments (see the manual). This is probably one of the most important functions of Winbinder, and almost every PHP WinBinder application uses it.
On the next line the wb_create_control() function is used to create a 'Label' control. This is also a very vital function, because it allows you to create different types of controls, and build up the interface of your application. Winbinder supports dozens of different types of controls, including a text box, listview, HTML control, label, button, and more. A complete list can be viewed by clicking here. As you can see, in the above example we create a label control with the caption set to 'Hello World!'.
Finally the wb_main_loop() function is called. This will start the event handler for the program. Although we don't use it in the above example, the event handler allows you to handle certain events in your application. Let's have a closer look at the event handler.
May 3rd, 2006 at 5:49 am
[…] Tutorial Source: PhpIt.net - Download […]
May 4th, 2006 at 6:31 am
looks really need. I would like to see some examples involving sql; plus is there any way to integrate it with web applications?? It would be great for example to have a website with pictures and then create something in Winbinder to upload pictures on it. Something like Flickr does.
August 23rd, 2006 at 11:54 am
This is really impressive.
I think it could be also good for user authentification. Though it is necessary to encrypt traffic at client side and decrypt on server side, as well as updating the client software with different algorithms to avoid a security leak through cracking the code by reverse engineering.