How can I get data from each column of TSbrowse?

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

How can I get data from each column of TSbrowse?

Post by dutch »

Dear All,

I need and informatioin from TSbrowse but I don't konw how to get it when I click on column in each TSbrowse (cCaption or cText) .

Best regards,
Dutch
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post by Detlef Hoefner »

Sorry Dutch,

i don't understand. What information do you want from your browse?

Regards,
Detlef
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post by Detlef Hoefner »

Hi Dutch,

may be, you mean this ?

oBrw:aColumns[ oBrw:nAtCol ]:cHeading

Regards,
Detlef
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Data in each specific Row and Column

Post by dutch »

Dear Detlef,

Thanks for prompt reply. I mean the text in each column of sbrowse.
for examples
Firstname Lastname Age
1 Kevin Smith 30
2 John Dely 25
3 David Sim 28
4 Ken Donald 34

When I click on column Firstname and row no. 2. The information I need is "John".

Regards,
Dutch
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

I found Eval( oBrw:aColumns[ oBrw:nAtCol(nCol) ]:bData ) )

Post by dutch »

Dear Detlef,

Thanks for your help, I've got it.

Eval( oBrw:aColumns[ oBrw:nAtCol( nCol ) ]:bData )


Regards,
Dutch
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Re: I found Eval( oBrw:aColumns[ oBrw:nAtCol(nCol) ]:bData

Post by Detlef Hoefner »

dutch wrote:Dear Detlef,

Thanks for your help, I've got it.

Eval( oBrw:aColumns[ oBrw:nAtCol( nCol ) ]:bData )


Regards,
Dutch
Hi Dutch

glad you found this out.

If you take the following suggestion you don't need to pass a column number.
eval( oBrw:aColumns[ oBrw:nCell ]:bData )

Best regards,
Detlef
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Dutch,

If you are browsing a database, the database pointer is at the record that is being displayed, so you can read the data right out of the database.

James
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Thanks and I've another qutestion?

Post by dutch »

Dear Detlef,

Thanks for another good idea but I try to use Drag and Drop but I cannot get the destination ::bData. Because I can get only nRow but I don't know what the Record number or data in this Row. How can I get the ::bData or Record No. from this drop row?

oBrw:oDragCursor := oCursor
oBrw:bDragBegin := { |nRow,nCol,Flags,Self| SetDropInfo( right(Eval( oBrw:aColumns[ oBrw:nAtCol( nCol ) ]:bData ),10)+ ;
Eval( oBrw:aColumns[ 2 ]:bData ) ) }

oBrw:bDropOver := { |uDropInfo,nRow,nCol,nKeyFlags| if(uDropInfo<>nil, ( MoveRms( uDropInfo+str( Int((nRow-25)/20),3 ), oBrw ) ), ) }

*Now I use this*
Function MoveRms( cData, oLbx )
oLbx:lNoLiteBar := .T.
oLbx:GoTop()
for x := 1 to val(right(cData,3))-1
oLbx:GoDown()
next
oLbx:lNoLiteBar := .F.
return

Best regards,
Dutch
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

How can I get the drop row information?

Post by dutch »

Dear James,

I use the master data is database but the ::aColumns are not data in record. I need the data from Drop row but I don't know how to get it.

Best regards,
Dutch
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Re: Thanks and I've another qutestion?

Post by Detlef Hoefner »

dutch wrote:Dear Detlef,

Thanks for another good idea but I try to use Drag and Drop but I cannot get the destination ::bData ...
Hi Dutch,

if you already now the record and you just have to find the corresponding dbf field,
i think you will have to use a translation table for your needs:

Code: Select all

#define POS_BRW    1
#define POS_FLD    2

aColFieldPos := {; // BrwPos, FieldPos
                    { 1,      1 },; // oBrw:Column 1 shows field# 1
                    { 2,      2 },; // oBrw:Column 2 shows field# 2
                    { 3,      5 } ; // oBrw Column 3 shows field# 5 
                }

/* now you just do  */

nPos := ascan( aColFieldPos, {|a| a[ POS_BRW ] == oBrw:nCell })

if nPos > 0 
   xxx->( fieldPut( aColField[ nPos ][POS_FLD ], xValue ) )
endif
Maybe this could suit your problem?

Best regards,
Detlef
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

How to Create Array during TSbrowse create?

Post by dutch »

Dear Detlef,

I've got it and it is the best way for now, if it cannot get from TSbrowse. How can I make array for each browse row during browse create?

Thanks&Regards,
Dutch
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Dutch,

TSBrowse (and all the browses) don't support dropping on a row, only dropping on a table. You will probably have to modify the browse source code to get this capability. I do think there was some discussion about this awhile back. You micht try doing a forum search.

>I've got it and it is the best way for now, if it cannot get from TSbrowse. How can I make array for each browse row during browse create?

The easiest way it to browse a database object. A database object already has a built-in buffer array, aBuffer. All the data from the record is read into this array each time the record pointer is moved.

James
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Re: How to Create Array during TSbrowse create?

Post by Detlef Hoefner »

dutch wrote:Dear Detlef,

I've got it and it is the best way for now, if it cannot get from TSbrowse. How can I make array for each browse row during browse create?

Thanks&Regards,
Dutch
Hi Dutch,

this is not very difficult :

Code: Select all

dbf->( dbEval( { || aadd( aYourArray, --- your data --- ) } ) )
But since you are working in FW16bits, it could be very dangerous to create an array with the same number of elements as your dbf->( lastrec() ).

This could be the moment to reflect about (x)Harbour :wink:

Regards,
Detlef
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Thank you very much Detlef & James

Post by dutch »

Dear Detlef & James,

I've got it. Thank you very much for your ideas.

Regards,
Dutch
Post Reply