Help : Any Class for Databse Look up with Multiple Columns

Help : Any Class for Databse Look up with Multiple Columns

Postby anserkk » Mon Sep 22, 2008 7:10 am

Friends,

Is there any class or sample code availabe for Database look up with multiple columns, which can be associated with a get object.

I understand that DBCOMBO can do this display if you concanate the two Data fileds into a a single string For Eg.DbfAlias->Code+DbfAlias->Name in the LIST. But the problem is that using this technique the control will not look neat.

To make it more clear. I am looking for a control like DBCOMBO but with Multiple Columns.

At certain times I want to display multiple columns popup help along with VALID clause of a get object.

Sample code or any hint to move in the right direction will be appreaciated. I beleive that it will be a very common requirement where most of the developers need in their app.

Regards

Anser
FWH 8.08
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby demont frank » Mon Sep 22, 2008 9:37 am

I made a class , originally with btnget and xbrowse , to simulate a combobox with multiple columns , and many other features (automatic update other controls)

I have rewritten it for fwh8.08 , and now it works with the get from 8.08

When there is enough intression , i could download it on rapidshare

Frank Demont
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby anserkk » Mon Sep 22, 2008 9:41 am

demont frank wrote:I made a class , originally with btnget and xbrowse , to simulate a combobox with multiple columns , and many other features (automatic update other controls)

I have rewritten it for fwh8.08 , and now it works with the get from 8.08

When there is enough intression , i could download it on rapidshare

Frank Demont


Dear Mr.Frank,

If you don't mind would you mind sharing it.

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby James Bott » Mon Sep 22, 2008 1:58 pm

Anser,

Now that GETs have an ACTION clause you can call any browse in a window or dialog from a button in a GET. So you can easily build anything you need.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby anserkk » Mon Sep 22, 2008 3:10 pm

James Bott wrote:Anser,

Now that GETs have an ACTION clause you can call any browse in a window or dialog from a button in a GET. So you can easily build anything you need.

Regards,
James


Dear Mr.James,

Are u talking about BtnGet ?. I could not find any samples on Btnget. When I tried to use I was getting compilation error. May be I have to include some .ch files. What I am trying is something like a DbCombo but with multiple columns which drops just below the get object .

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby James Bott » Mon Sep 22, 2008 4:32 pm

Anser,

No I am not referring to btnget. Now (as of FWH 8.08, I think) regular GETs have an ACTION clause. If you use this clause then the GET shows a button (like a btnget). You can call anything you want from this button.

You will have to create a function with either a window or dialog containing the browse you want and any buttons. Either you can just center it in the window or you will have to calclulate its position from the location of the GET if you want it displayed under the GET.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby anserkk » Mon Sep 22, 2008 5:56 pm

Thankyou Mr.James,

Yes, I have noticed the Action clause along with the get. I shall try as suggested by you.

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby StefanHaupt » Tue Sep 23, 2008 6:41 am

Frank,

demont frank wrote:When there is enough intression , i could download it on rapidshare


yes, please, I´m interested, too
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Download link

Postby demont frank » Tue Sep 23, 2008 7:50 am

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 == 8)


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
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby anserkk » Tue Sep 23, 2008 8:12 am

Thank you Mr.Frank
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby StefanHaupt » Wed Sep 24, 2008 7:38 am

thanks
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Class txcombox , problems with setting focus on nextget

Postby demont frank » Thu Sep 25, 2008 9:31 am

To set correct focus after executing a baction from a get (at least in the module array seek from MDI window) , the program has to be changed

If wanted i will send the changes

Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Re: Class txcombox , problems with setting focus on nextget

Postby anserkk » Thu Sep 25, 2008 9:53 am

demont frank wrote:To set correct focus after executing a baction from a get (at least in the module array seek from MDI window) , the program has to be changed

If wanted i will send the changes

Frank


Dear Frank,

Please send the changes

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Class txcombox , problems with setting focus on nextget

Postby demont frank » Thu Sep 25, 2008 10:48 am

anserkk wrote:
demont frank wrote:To set correct focus after executing a baction from a get (at least in the module array seek from MDI window) , the program has to be changed

If wanted i will send the changes

Frank


Dear Frank,

Please send the changes

Regards

Anser


Send a email to demont.frank@gmail.com or give me your e-mail

Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby anserkk » Thu Sep 25, 2008 11:50 am

Dear Mr.Frank,

I have sent a mail to you.

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests