FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to read a cell in a TxBrowse()
Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
How to read a cell in a TxBrowse()
Posted: Mon May 01, 2006 08:46 PM
I am just begining to use TxBrowse(). I am trying the accomplish the following: When moving the cursor over the cells, I would like the contens of each cell to appear in a Say field, without clicking on the cell. Until now, I have been able to arrive here:

cSay := SPACE(40)
@ 1,1 SAY ::oSay VAR cSay SIZE 100,20 PIXEL   // Here will be shown the cell data 
oBrw:bMMoved := {|nR,nC| ::ReadCell(nR, nC)}    // Capture cursor movement
...... 

METHOD ReadCell(nR,nC) 
nRow  := ::oBrw:MouseRowPos(nR) 
nCol  := ::oBrw:MouseColPos(nC) 
cData := ????? 
::oSay:VarPut(STR(nRow)+STR(nCol) +":  "+ cData) 
RETURN NIL

Obviouslyly, my question is how to obtain cData, that is, the cell contens based on its row and col within the TxBrowse. Could anybody help?
Thanks
Rafael
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to read a cell in a TxBrowse()
Posted: Tue May 02, 2006 06:42 AM

Can you build a minimal and self-contained sample to experiment with?

EMG

Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
How to read a cell in a TxBrowse()
Posted: Tue May 02, 2006 08:24 AM

Enrico:
I just sent the sample to your private mail
Thanks
Rafael

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
How to read a cell in a TxBrowse()
Posted: Tue May 02, 2006 12:26 PM

You may calculate the correct record knowing the first record of the browse and adding to it the cursor row number.

Sorry but I have no time to build a working sample.

EMG

Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
How to read a cell in a TxBrowse()
Posted: Tue May 02, 2006 12:44 PM
Enrico:
You may calculate the correct record knowing the first record of the browse and adding to it the cursor row number.

I think that would work only if the database is not indexed...

Anyway, I can not believe that there is not a simple way to obtain the value al cell(Row, Col). After all, it is the same value that is is being displayed in the Browse itself... The only reason I want to retrieve it is to be able to show it in a larger size than the cell itself permits...

Thanks for your interest; I'll keep trying...
Rafael
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
How to read a cell in a TxBrowse()
Posted: Tue May 02, 2006 12:54 PM
Rafael Clemente wrote:I think that would work only if the database is not indexed...


No, it will also work with indexes. Just use OrdKeyNo() instead of RecNo().

EMG
Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
How to read a cell in a TxBrowse()
Posted: Tue May 02, 2006 01:08 PM

Ok, Enrico. I'll try and I'll let you know further progress
Rafael

Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
How to read a cell in a TxBrowse()
Posted: Wed May 03, 2006 07:44 AM

Enrico:
You were right: After a bit of database skiping up and down I got the problem solved. The trick was reading the data directly off the Dbf, rather than the browse.
Thanks a lot once more
Rafael

Continue the discussion