Page 1 of 1
How can I get data from each column of TSbrowse?
Posted:
Mon Jul 24, 2006 9:49 am
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
Posted:
Mon Jul 24, 2006 10:04 am
by Detlef Hoefner
Sorry Dutch,
i don't understand. What information do you want from your browse?
Regards,
Detlef
Posted:
Mon Jul 24, 2006 10:23 am
by Detlef Hoefner
Hi Dutch,
may be, you mean this ?
oBrw:aColumns[ oBrw:nAtCol ]:cHeading
Regards,
Detlef
Data in each specific Row and Column
Posted:
Mon Jul 24, 2006 11:28 am
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
I found Eval( oBrw:aColumns[ oBrw:nAtCol(nCol) ]:bData ) )
Posted:
Mon Jul 24, 2006 11:49 am
by dutch
Dear Detlef,
Thanks for your help, I've got it.
Eval( oBrw:aColumns[ oBrw:nAtCol( nCol ) ]:bData )
Regards,
Dutch
Re: I found Eval( oBrw:aColumns[ oBrw:nAtCol(nCol) ]:bData
Posted:
Mon Jul 24, 2006 12:25 pm
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
Posted:
Mon Jul 24, 2006 3:01 pm
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
Thanks and I've another qutestion?
Posted:
Tue Jul 25, 2006 4:24 pm
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
How can I get the drop row information?
Posted:
Tue Jul 25, 2006 4:27 pm
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
Re: Thanks and I've another qutestion?
Posted:
Tue Jul 25, 2006 6:47 pm
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 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
How to Create Array during TSbrowse create?
Posted:
Wed Jul 26, 2006 3:04 am
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
Posted:
Wed Jul 26, 2006 5:39 am
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
Re: How to Create Array during TSbrowse create?
Posted:
Wed Jul 26, 2006 7:36 am
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 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
Regards,
Detlef
Thank you very much Detlef & James
Posted:
Wed Jul 26, 2006 11:26 am
by dutch
Dear Detlef & James,
I've got it. Thank you very much for your ideas.
Regards,
Dutch