How can I get data from each column of TSbrowse?

How can I get data from each column of TSbrowse?

Postby dutch » Mon Jul 24, 2006 9:49 am

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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Detlef Hoefner » Mon Jul 24, 2006 10:04 am

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

Postby Detlef Hoefner » Mon Jul 24, 2006 10:23 am

Hi Dutch,

may be, you mean this ?

oBrw:aColumns[ oBrw:nAtCol ]:cHeading

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

Data in each specific Row and Column

Postby dutch » Mon Jul 24, 2006 11:28 am

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: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Postby dutch » Mon Jul 24, 2006 11:49 am

Dear Detlef,

Thanks for your help, I've got it.

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


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

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

Postby Detlef Hoefner » Mon Jul 24, 2006 12:25 pm

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
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Mon Jul 24, 2006 3:01 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Thanks and I've another qutestion?

Postby dutch » Tue Jul 25, 2006 4:24 pm

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: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

How can I get the drop row information?

Postby dutch » Tue Jul 25, 2006 4:27 pm

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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Thanks and I've another qutestion?

Postby Detlef Hoefner » Tue Jul 25, 2006 6:47 pm

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  Expand view
#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
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

How to Create Array during TSbrowse create?

Postby dutch » Wed Jul 26, 2006 3:04 am

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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby James Bott » Wed Jul 26, 2006 5:39 am

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: How to Create Array during TSbrowse create?

Postby Detlef Hoefner » Wed Jul 26, 2006 7:36 am

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  Expand view
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
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Thank you very much Detlef & James

Postby dutch » Wed Jul 26, 2006 11:26 am

Dear Detlef & James,

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

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


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 2 guests