Page 1 of 1

How to read a cell in a TxBrowse()

Posted: Mon May 01, 2006 8:46 pm
by Rafael Clemente
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:

Code: Select all

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

Re: How to read a cell in a TxBrowse()

Posted: Tue May 02, 2006 6:42 am
by Enrico Maria Giordano
Can you build a minimal and self-contained sample to experiment with?

EMG

Posted: Tue May 02, 2006 8:24 am
by Rafael Clemente
Enrico:
I just sent the sample to your private mail
Thanks
Rafael

Posted: Tue May 02, 2006 12:26 pm
by Enrico Maria Giordano
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

Posted: Tue May 02, 2006 12:44 pm
by Rafael Clemente
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

Posted: Tue May 02, 2006 12:54 pm
by Enrico Maria Giordano
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

Posted: Tue May 02, 2006 1:08 pm
by Rafael Clemente
Ok, Enrico. I'll try and I'll let you know further progress
Rafael

Posted: Wed May 03, 2006 7:44 am
by Rafael Clemente
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