How to read a cell in a TxBrowse()

Post Reply
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

How to read a cell in a TxBrowse()

Post 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
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post by Rafael Clemente »

Enrico:
I just sent the sample to your private mail
Thanks
Rafael
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post by Rafael Clemente »

Ok, Enrico. I'll try and I'll let you know further progress
Rafael
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post 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
Post Reply