How to read a cell in a TxBrowse()

How to read a cell in a TxBrowse()

Postby Rafael Clemente » Mon May 01, 2006 8: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:

Code: Select all  Expand view  RUN
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

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

Postby Enrico Maria Giordano » Tue May 02, 2006 6:42 am

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Rafael Clemente » Tue May 02, 2006 8:24 am

Enrico:
I just sent the sample to your private mail
Thanks
Rafael
User avatar
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

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

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

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

Postby Rafael Clemente » Tue May 02, 2006 1:08 pm

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

Postby Rafael Clemente » Wed May 03, 2006 7: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
User avatar
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 30 guests