http://rapidshare.com/files/147632103/T ... H.ZIP.html
A exe- and doc file are included , a part from the doc-file is published here (copied , sorry for the layout)
Frank
TXCombox control for Fivewin for XHarbour
1) Using TxCombox
===============
In my opinion has the combo class from fivewin limitations :
1) Only one column
2) No incremental search
3) Not very fast , hardly to use for big arrays. It is obvious that in harbour big arrays can be used!
Using TXcombox can overcome this limitations .
We can have more columns:
Using arrays an incremental search on each column is possible. Browsing a dbf : incremental search on each column with a index order. Clicking on column header sort the array and set this column for the seek
Each column can correspond with a control from the dialog (link Object) . Selecting an element from the browse will update all the control’s attached to the Get object.
In many cases the array will be build from a dbf , using the routines from the program
2) Additional lib’s to use
==================
CT (xhb) , LIBCT (BCC)
Xbrowse , with a few changes , is used to perform the browses
See XXBROWSE.PRG
3 ) Using this object
===============
This class can be used in Array from program , array from dbf , dbf seek
1) Array , declared in the program
See module0 for details
oComBox := TxCombox():new(Arr)
Creates the class. Column properties are stored in a associative array oCombox:aCols as a object, each column can be reached by his number or his name.
Default values :
oCol:cHeading : “COLUMN “ + LTRIM(STR(index))
Column name := Nm_Alfa(oCol:cHeading)
only uppercase , ascii from 65 – 90 , is used
oCol:nWidth := MAX(Len(Arraydata),LEN(cHeading))*8 (nCharwidth ==
Changing this values can be done :
1) oComBox := TxCombox():new(Arr , {{“Num”,30},})
New() accepts as second parameter a 2-dimensional array :
{{cHeading,nWidth,cFooting,bData},…..}
bData is only used for building a array from the dbf , or dbf seek
Note that column properties are accessible as :
:aCols[“NUM”]:nWidth := 40 or :aCols[1]:nWidth := 40
2) After oComBox := TxCombox():new(Arr)
:aCols[“COLUMN1”]:nWidth := 40 or :aCols[1]:nWidth := 40
:aCols[“COLUMN1”]:cHeading := “Num” changes the heading NOT the column name
Can also be used :Changecol(ColName or num, heading , nwidth , cfooting)
:ChangeCol(“Column1”,”Num”,40) or :ChangeCol(1,”Num”,40)
Column name is also changed to NUM !!!
2) Array , to build from dbf
1) ArrObjCol := LoadXDbfCol(ArrFields) Creates associative array with column objects
Default values : see TSCOMCOL:NEW
ArrFields see 4)
This function can also called as a method from TxCombox
2) ReadDbf(@Arr , @ArrFields , cFilter , cOrder , from , To )
Arrfields is a array with field definitions or TsComCol objects (see 4)
3) oComBox := TxCombox():new(Arr , ArrObjCol , .F. , cAlias) //, NoArray , "GEMEENTE")
from here we have the same situation as in array from program
It is possible to only execute 3 : oComBox := TxCombox():new( , ArrFields , .F. , cAlias)
The program builds oCombox:ArrObjCol , but oCombox:arr must build separately
With oCombox:BuildArr()
3) Dbf-Seek
1) ArrObjCol := LoadXDbfCol(ArrFields) See 2)
2) oComBox := TsCombox():new( , ArrObjCol , .T. , calias)
Or in one step : TsCombox():new( , ArrField , .T. , calias)
4) ArrFields , second parameter in LoadXdbf , Readdbf or ::new()
GEMEENTE.dbf has 3 fields : gemeente (c31) , postnr (c4) , provincie (c20)
1) LoadDbf( NIL )
2) LoadDbf({1 , “Postnr” ,3})
3) LoadDbf({ {“Gemeente”,248 , , Fieldblock(“Gemeente”)} , ;
{“Postnr”,40, , 2 } , ;
{“Provincie,160, , “Provincie”} })
4) LoadDbf({ {“Gemeente”,264, , 1 } , 2 , 3}
Will have the same result :
1) arrfields may be nil and is then transformed to an array from all fieldnumbers
2) When arrfields is one dimensional , each element is a field number or field name
3) a field number or fieldname can be substituded by a array from 4 elements :
{ cHeading , nWidth , cFooting , Field number/name or CodeBlock }
4) 2) and 3) may be mixed.
Using these conventions , we can always ( array from dbf) :
1) oCombox := Txcombox():new( , Arrfield , ….) First parameter NIL !!!!!
2) Change column properties when needed with oCombox:change(…)
Add (:AddCol) or delete columns (hDel(…))
3) oCombox:BuildArr(….)
4) To make a combobox we have to :
REDEFINE BTNGET oGet ….
oComBox:MakeGetBox(oGet , Column index or name)
To link with another control :
oGet:LinkBlock(oControl , Column index or name)
SEE MODULE1 in testcomb.prg as a complete example