...
with object oBrw
:aCols[ 2 ]:bToolTip := {| oBrw, nRow, nCol, nKeyFlags| 'Code: '+oBrw:aCols[1]:Value() +CRLF+;
'Desc: '+oBrw:aCols[2]:Value() }
end
...
nageswaragunupudi wrote:This does not give you the correct result all the times.
For example, the browse cursor is on 3rd row.
The user hovers the mouse on 5th row. The tooltip is expected to show the information relating to the 5th row, but actually shows information relating to the 3rd row.
Coding this bToolTip is really tricky. You need to find the aCol[ 1 ]:Value if the browse cursor is moved to 5th row.
oBrw:aCols[ 3 ]:bToolTip := { | oBrw, nRow, nCol, nFlags | ;
oBrw:aArrayData[ oBrw:nArrayAt - oBrw:nRowSel + ;
oBrw:MouseRowPos( nRow ), 2 ] }
function XbrDbfToolTip()
local oDlg, oBrw, oFont
USE CUSTOMER
DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
DEFINE DIALOG oDlg SIZE 400,300 PIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
ALIAS 'CUSTOMER' AUTOCOLS CELL LINES NOBORDER
oBrw:aCols[ 2 ]:bToolTip := { | oBrw, nRow, nCol, nFlags | MyToolTip( oBrw, nRow, nCol, nFlags) }
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
CLOSE CUSTOMER
return nil
//------------------------------------------------------------------//
static function MyToolTip( oBrw, nRow, nCol, nFlags )
local nSaveRec := oBrw:BookMark
local nMouseRow := oBrw:MouseRowPos( nRow )
local cRet := ''
if nMouseRow > 0
oBrw:Skip( nMouseRow - oBrw:nRowSel )
// or alternatively,
// oBrw:KeyNo( oBrw:KeyNo() + nMouseRow - oBrw:nRowSel )
cRet := ( oBrw:cAlias )->First
oBrw:BookMark := nSaveRec
endif
return cRet
//------------------------------------------------------------------//
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"
#include "hbcompat.ch"
REQUEST DBFCDX
#xtranslate <x> [is] between <a> and <b> => ( <x> >= <a> .and. <x> <= <b> )
#xtranslate <x> [is] not between <a> and <b> => !( <x> between <a> and <b> )
//----------------------------------------------------------------------------//
FUNCTION main()
local oDlg, oBrw, oFont
local aBmp := { ;
"c:\fwh\bitmaps\16array.bmp", ;
"c:\fwh\bitmaps\16back.bmp", ;
"c:\fwh\bitmaps\16block.bmp", ;
"c:\fwh\bitmaps\16char.bmp", ;
"c:\fwh\bitmaps\16clip.bmp", ;
"c:\fwh\bitmaps\16code.bmp", ;
"c:\fwh\bitmaps\16COPY.bmp", ;
"c:\fwh\bitmaps\16date.bmp", ;
"c:\fwh\bitmaps\16dbgbrk.bmp" }
SetBalloon( .t. )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL FONT oFont
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg COLUMNS 1,1 ;
ARRAY aBmp HEADERS "Bmp", "File" SIZES 32 LINES CELL
oBrw:aCols[ 1 ]:cDataType := "F"
ADD TO oBrw AT 1 DATA oBrw:KeyNo() HEADER "No." PICTURE "99"
oBrw:bToolTips := { | oBrw, nRow | ShowBmpFileName( oBrw, nRow ) }
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
//----------------------------------------------------------------------------//
static function ShowBmpFileName( oBrw, nRow )
local nMouseRow := oBrw:MouseRowPos( nRow )
if nMouseRow > 0
return oBrw:aArrayData[ oBrw:nArrayAt - oBrw:nRowSel + nMouseRow ]
endif
return ""
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 117 guests