FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour help for xbrowse tooltip
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

help for xbrowse tooltip

Posted: Sat Feb 21, 2015 03:13 PM
please Look this Image :



I use and array aDataDay[ndocente][nOra]
I need to Know ( for the data of return ) some data as when I move the mouse over:

the row and the col to have the day and the hour on the case of picture 14 ( 1 monday 4 number of Hour)
the number of teacher ( nrecord) in this picture 8
and the value of cell in this picture 4B

How I can found ths data ? thanks

then with hese data I can search on archive the matter of lesson and I can show it with a tooltip
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: help for xbrowse tooltip

Posted: Sat Feb 21, 2015 11:25 PM
Code (fw): Select all Collapse
oCol:bToolTip := { | brw,r,c,f,oMouseCol,nMouseRow| MyColToolTip( brw,r,c,f,oMouseCol,nMouseRow ) }

...
...

function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

   local uVal, nRow, nCol
   
   nRow  := oBrw:nArrayAt + nMouseRow - oBrw:nRowSel
   nCol  := oMouseCol:nCreationOrder
   uVal  := oBrw:nArrayData[ nRow, nCol ]
   
return cValToChar( uVal )
Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM

Re: help for xbrowse tooltip

Posted: Sun Feb 22, 2015 06:43 PM

Hi, I need something similar but to do so in all cells and is to browse my oQry or this is just to browse with array, try as in the example but it gives me error "UVAL: = oBrw: nArrayData [nRow, nCol] "/ Message not found: TXBrowse: NARRAYDATA, thanks, greetings ... using google translator... :shock:

Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM

Re: help for xbrowse tooltip

Posted: Sun Feb 22, 2015 07:55 PM

+1

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: help for xbrowse tooltip

Posted: Sun Feb 22, 2015 11:36 PM
joseluisysturiz wrote:Hi, I need something similar but to do so in all cells and is to browse my oQry or this is just to browse with array, try as in the example but it gives me error "UVAL: = oBrw: nArrayData [nRow, nCol] "/ Message not found: TXBrowse: NARRAYDATA, thanks, greetings ... using google translator... :-)


My reply was only for Array Browse.

For any other browse:
Code (fw): Select all Collapse
oCol:bToolTip := { | brw,r,c,f,oMouseCol,nMouseRow| MyColToolTip( brw,r,c,f,oMouseCol,nMouseRow ) }

...
...

function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

   local uBm, uVal
   
   if nMouseRow != oBrw:nRowSel
      uBm   := oBrw:BookMark
      Eval( oBrw:bSkip, nMouseRow - oBrw:nRowSel )
      uVal  := oMouseCol:Value
      oBrw:BookMark := uBm
   else
      uVal  := oMouseCol:Value
   endif   
   
return cValToChar( uVal )
Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: help for xbrowse tooltip

Posted: Mon Feb 23, 2015 05:02 PM
Mr Nages,

Code (fw): Select all Collapse
 Error occurred at: 23-02-2015, 18:00:41
   Error description: Error BASE/1004  Message not found: TXBROWSE:NARRAYDATA

Stack Calls
===========
   Called from: .\source\function\HARBOUR.PRG => _CLSSETERROR( 244 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:NARRAYDATA( 8313 )
   Called from: source\Ptabell.prg => MYCOLTOOLTIP( 332 )
   Called from: source\Ptabell.prg => (b)PTABELLONE( 187 )



I made :

for nI = 2 to 61

oApp():aCols[ nI ]:bToolTip := { | brw,r,c,f,oMouseCol,nMouseRow| MyColToolTip( brw,r,c,f,oMouseCol,nMouseRow ) }

next


...


function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

local uVal, nRow, nCol

nRow := oBrw:nArrayAt + nMouseRow - oBrw:nRowSel
nCol := oMouseCol:nCreationOrder
uVal := oBrw:nArrayData[ nRow, nCol ]

return cValToChar( uVal )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM

Re: help for xbrowse tooltip

Posted: Mon Feb 23, 2015 06:27 PM
Mr Nages: (tested on dbf)

Path and name: D:\COUNTRY\NEWCONT32\Wcont32.Exe (32 bits)
Size: 2,646,016 bytes
Time from start: 0 hours 0 mins 13 secs
Error occurred at: 23/02/2015, 11:52:26
Error description: Error BASE/1082 Argument error: -
Args:
[ 1] = U
[ 2] = N 2

Stack Calls
===========
Called from: D:\COUNTR~1\NEWCON~1\wcont32.prg => MYCOLTOOLTIP(574)
Called from: D:\COUNTR~1\NEWCON~1\wcont32.prg => (b)COMPROBANTE(461)
Called from: XBROWSE.PRG => TXBROWSE:MOUSEMOVE(3403)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TCONTROL:HANDLEEVENT(1490)
Called from: XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10762)
Called from: .\source\classes\WINDOW.PRG => _FWH(3391)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(976)
Called from: D:\COUNTR~1\NEWCON~1\wcont32.prg => MAIN(192)


Code (fw): Select all Collapse
   oCol = oBrw:AddCol() 
   oCol:bStrData = { || (cAlias)->NOMBRE } 
   oCol:cHeader = "DESCRIPCION DE LA CUENTA" 
   oCol:nEditType = 0   //no editable
   oCol:bToolTip := { | oBrw,r,c,f,oMouseCol,nMouseRow| MyColToolTip( oBrw,r,c,f,oMouseCol,nMouseRow ) }

//----------------------------------------------------------
Function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

   local uBm, uVal
   
   if nMouseRow != oBrw:nRowSel
      uBm   := oBrw:BookMark
      Eval( oBrw:bSkip, nMouseRow - oBrw:nRowSel )   //here  (variable nMouseRow do not exists)
      uVal  := oMouseCol:Value
      oBrw:BookMark := uBm
   else
      uVal  := oMouseCol:Value
   endif   
   
return cValToChar( uVal )


Regards
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: help for xbrowse tooltip

Posted: Mon Feb 23, 2015 07:36 PM

Silvio
Change nArrayData as aArrayData.
It was my typing mistake

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: help for xbrowse tooltip

Posted: Mon Feb 23, 2015 07:52 PM
This is working well for me here
Code (fw): Select all Collapse
function TestTip()

   local oDlg, oFont, oBrw

   USE CUSTOMER

   DEFINE DIALOG oDlg SIZE 600,500 PIXEL
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS ;
      CELL LINES NOBORDER

   oBrw:bToolTips   := ;
         { | oBrw,r,c,f,oMouseCol,nMouseRow| MyColToolTip( oBrw,r,c,f,oMouseCol,nMouseRow ) }

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------
Function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

   local uBm, uVal

   if nMouseRow != oBrw:nRowSel
      uBm   := oBrw:BookMark
      Eval( oBrw:bSkip, nMouseRow - oBrw:nRowSel )   
      uVal  := oMouseCol:Value
      oBrw:BookMark := uBm
   else
      uVal  := oMouseCol:Value
   endif

return cValToChar( uVal )


Instead of oCol:bToolTip, I assigned the codeblock to oBrw:bToolTips. This is the shortcut to assign the same codeblock to all columns in a single statement.

I am able to see the correct tool tips for all columns and there are no errors. Please try the above example just as it is. You may use any DBF.

Some advices though not relating to this:
bStrData has been deprecated many years back.
You can enjoy all the power and all features of xbrowse only when you use the command sytnax.
You have full liberty not to use the command syntax but at the cost of not using all features and full power of xbrowse.
Regards



G. N. Rao.

Hyderabad, India
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM

Re: help for xbrowse tooltip

Posted: Tue Feb 24, 2015 01:09 AM

function TestTip()

local oDlg, oFont, oBrw

USE CUSTOMER

DEFINE DIALOG oDlg SIZE 600,500 PIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" AUTOCOLS ;
CELL LINES NOBORDER

oBrw:bToolTips := ;
{ | oBrw,r,c,f,oMouseCol,nMouseRow| MyColToolTip( oBrw,r,c,f,oMouseCol,nMouseRow ) }

oBrw:CreateFromCode()

ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------
Function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

local uBm, uVal

if nMouseRow != oBrw:nRowSel
uBm := oBrw:BookMark
Eval( oBrw:bSkip, nMouseRow - oBrw:nRowSel )
uVal := oMouseCol:Value
oBrw:BookMark := uBm
else
uVal := oMouseCol:Value
endif

return cValToChar( uVal )

Mr. Nages.
Thanks for your time and patience, but I have not been able to make it work. Maybe it's my 1204 version .
Best regards.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: help for xbrowse tooltip

Posted: Tue Feb 24, 2015 01:29 AM
Thanks for your time and patience, but I have not been able to make it work. Maybe it's my 1204 version .

Yes. That is the reason
Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: help for xbrowse tooltip

Posted: Tue Feb 24, 2015 03:55 PM

thanks Nages,
it show the value of cell ok
but I have another problem because if you remember I have 61 column (first column is the teachers and the I have 10 columns for day for the hours)
with your script I have the number of column ===> nCol-1 ( the first is teachers)
How I can calc the day to have a return data type for sample 16 ( monday at 6 hour)

I tried with
nday:= int( (nCol-1) / 6) but it not run ok

I need this data to search on database the matter od lesson and show it with tooltip
Any idea ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: help for xbrowse tooltip

Posted: Wed Feb 25, 2015 01:20 AM
FranciscoA wrote:
Thanks for your time and patience, but I have not been able to make it work. Maybe it's my 1204 version .
Best regards.

This may work for your version
Code (fw): Select all Collapse
Function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

   local uBm, uVal

   // for older versions
   nMouseRow   := oBrw:MouseRowPos( r )
   oMouseCol   := oBrw:MouseColPos( c )
   oMouseCol   := oBrw:ColAtPos( oMouseCol )
   //

   if nMouseRow != oBrw:nRowSel
      uBm   := oBrw:BookMark
      Eval( oBrw:bSkip, nMouseRow - oBrw:nRowSel )   //here  (variable nMouseRow do not exists)
      uVal  := oMouseCol:Value
      oBrw:BookMark := uBm
   else
      uVal  := oMouseCol:Value
   endif

return cValToChar( uVal )

If you can please test and confirm if this is working, it may be useful for other users using old versions.
Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM

Re: help for xbrowse tooltip

Posted: Wed Feb 25, 2015 04:24 PM
I use mysql and perfect function, use it as done Francisco and shows me the contents of any cell tool tip, thank you very much for your help...saludos... :-)

Code (fw): Select all Collapse
oBrow:bToolTips := { | oBrow, r, c, f, oMouseCol, nMouseRow| MyColToolTip( oBrow, r, c, f, oMouseCol, nMouseRow ) }

function MyColToolTip( oBrw, r, c, f, oMouseCol, nMouseRow )

   local uBm, uVal

   if nMouseRow != oBrw:nRowSel
      uBm   := oBrw:BookMark
      Eval( oBrw:bSkip, nMouseRow - oBrw:nRowSel )
      uVal  := oMouseCol:Value
      oBrw:BookMark := uBm
   else
      uVal  := oMouseCol:Value
   endif

return cValToChar( uVal )
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM

Re: help for xbrowse tooltip

Posted: Wed Feb 25, 2015 07:14 PM

José Luis.
Do you can tell us what version are you using?

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql