Author: Horst Nogajski
Licence: LGPL (http://www.opensource.org/licenses/lgpl-license.html)
Version: 1.0 BETA (2007-01-03)
You can download the class at phpclasses.org!
UP (to the list)
WinBinder is a open source extension for PHP. It allows PHP programmers to easily build native Windows applications.
Click here for more information.
I've tested with PHP 4 on W2k, only. Used WinBinder Version: 0.46.189
Besides the need of a more comfortable Sorting with ListViews, I want to ease up the configuration of ListViews during coding time. Very unlikely to me was to define the width for columns at coding time. So I decide to delegate all this stuff to the user at execution time of the apps.
This is a sample-app with two ListViews, both handled by it's own class instance. Following the numbered indicators you see the StatusBar with different informations at #1.
#2 shows the little Button at the TopLeft-Position of the ListView, which only gets visible when the mouse hovers the window-area 10 pix above the ListView. This Button opens the Configurator-window to the user. (See next screenshot)
The ListViews can have individual colors for text and background. Also like at #3, they may have CheckBoxes and/or Lines, or not.
When using the class-extension "hnwb_ListView_Buttons" instead of the base-class, you have five default-buttons like at #4. The buttons only appear when the mouse hovers the 18 pix area beneath the ListView. Also all buttons which actions don't make sence on the current ListView-situation are shown, but disabled.
The Configurator-Window lets the user save the ColumnWidth, selecting Colors, display or hide lines and checkboxes, also optionally define TextAligns and sorting-lists for one, some or all Columns.
When placing a ListView on a TabPage, the MouseMoves aren't catched. Therefor the configured Buttons are always visible.
Additionally you have to add one more line of code when creating the Class-Control:
I have packed a ZIP with the needed class-files 'hnwb_ListView.class.php', 'hn_basic.class.php', 'hn_ini.class.php' and 4 Example-Apps. Also this html-docfile is included.
In the first ExampleApp, a ListView is created with disabled Configurator-Window and therefor also the automatically creation of columnheaders isn't used. All is done manually: set the Column-Header-Names, define Column-width, optionally Textalign and some hirarchically sort-lists.
The second ExampleApp creates the same ListView, but delegates all settings-stuff via enabled Configurator-Window to the user. It also uses the Extended-Class-Version that adds some Default-Buttons to the ListView.
The third ExampleApp is a bit advanced, because it creates an own Class-Extension to the hnwb_ListView_Buttons-Class. It defines four own Buttons to transfer selected or checked Records from this ListView to another one via copy or move, (wow)! The second ListView collects all Records from the first one and also allows duplicate entries. It has the default-Buttons to delete Records.
You can pick the latest Zipfile here!
Happy coding!