xBrowse Cell ToolTip

xBrowse Cell ToolTip

Postby fraxzi » Mon Mar 22, 2010 8:35 am

Dear all,

How can I assign ToolTip for each xBrowse Cell?


Regards,
FAP
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: xBrowse Cell ToolTip

Postby nageswaragunupudi » Mon Mar 22, 2010 11:05 am

You can use oCol:bToolTip.

This codeblock is evaluated with parameters oBrw, nRow,nCol,nKeyFlags. nRow and nCol are in pixels relative to the browse. The text returned by evaluating the codeblock is displayed as cell's tooltip.

Important Caution: The cell for which the tooltip being displayed may be in a row different from the current row of browse. It is your responsibility to know which row the tooltip cell belongs to and retrieve the values.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Cell ToolTip

Postby fraxzi » Tue Mar 23, 2010 12:58 am

Dear RAO,

Thanks so much..

I did this:
Code: Select all  Expand view

...
with object oBrw
     :aCols[ 2 ]:bToolTip := {| oBrw, nRow, nCol, nKeyFlags| 'Code: '+oBrw:aCols[1]:Value() +CRLF+;
                                                             'Desc: '+oBrw:aCols[2]:Value() }
end
...
 


it shows exactly what I wish for..


My best regards,
FAP
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: xBrowse Cell ToolTip

Postby nageswaragunupudi » Tue Mar 23, 2010 5:44 am

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Cell ToolTip

Postby fraxzi » Tue Mar 23, 2010 7:11 am

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.




Dear RAO,

Yes it is tricky... Shows only the tooltip of current selected row..

Do you have a solution or starting point with this?

Regards,
FAP
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: xBrowse Cell ToolTip

Postby nageswaragunupudi » Tue Mar 23, 2010 10:41 am

Its rather easier when we browse arrays.

1. The selected row is
nAt := oBrw:nArrayAt
2. Visible Row number of the selected row in the display is
nRowSel := oBrw:nRowSel.
3. Visible Row number where the mouse is positioned is
nToolTipRow := oBrw:MouseRowPos( nRow ) // nRow from the parameter to the codeblock

4. We want the Array Row Number where the mouse is hovering:
nToolTipAt := oBrw:nArrayAt - oBrw:nRowSel + oBrw:MouseRowPos( nRow )

Value to display in the tooltip is oBrw:aArrayData[ nToolTipAt ][ <your column> ]

In case of non array datasource, we need to move to the new record, read data and reposition to the original record. I don't think it is worthwhile.

In any case, first test with an Array Browse and then decide.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Cell ToolTip

Postby nageswaragunupudi » Tue Mar 23, 2010 11:07 am

I tested just now. This code is working for me with arrays.
Code: Select all  Expand view
  oBrw:aCols[ 3 ]:bToolTip := { | oBrw, nRow, nCol, nFlags | ;
     oBrw:aArrayData[ oBrw:nArrayAt - oBrw:nRowSel + ;
     oBrw:MouseRowPos( nRow ), 2 ] }

 

You may adopt your column numbers and other logic.

Incidentally, there is a minor defect in implementation of this tooltip. Tooltip is not refreshed when we move from row to row in the same column. User has to leave the column and re-enter the column on a different row.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Cell ToolTip

Postby nageswaragunupudi » Tue Mar 23, 2010 11:21 am

This is the code for non-array browses.
Code: Select all  Expand view
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

//------------------------------------------------------------------//
 

Theoretically this is correct code. But at times this is showing wrong results.
Probably either the result of MouseRowPos() method is not very accurate all the times or the nRow parameter value is not correct all the times.
Please test for yourself
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Cell ToolTip

Postby ukoenig » Wed Jun 29, 2011 10:27 pm

Mr. Rao,

I don't know, if it can be used, to display the complete Cell-text ?
I would like to show the full path / name of a selected BMP without using HScroll.

Image

...
...
oBrw1:aCols[ 2 ]:nWidth := 70
oBrw1:aCols[ 2 ]:nEditType := TYPE_IMAGE
oBrw1:aCols[ 2 ]:lBmpStretch := .f.
oBrw1:aCols[ 2 ]:lBmpTransparent := .t.
oBrw1:aCols[ 2 ]:bStrImage := {|oCol, oLbx70| oBrw1:aRow[ 3 ] }
oBrw1:aCols[ 2 ]:nDataBmpAlign := AL_CENTER
oBrw1:aCols[ 2 ]:bPopUp := { | o | ColMenu( o ) }

oBrw1:aCols[ 3 ]:nWidth := 170
oBrw1:aCols[ 3 ]:nEditType := EDIT_BUTTON
oBrw1:aCols[ 3 ]:bEditBlock := {|nRow, nCol, oCol| oCol:Value := GET_BMP()}

oBrw1:CreateFromCode()


Best Regards
Uwe :lol: :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: xBrowse Cell ToolTip

Postby nageswaragunupudi » Thu Jun 30, 2011 1:36 am

Are you using array to browse?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Cell ToolTip

Postby nageswaragunupudi » Thu Jun 30, 2011 3:10 am

Mr Uwe

This is the suggested code:
Code: Select all  Expand view
#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 ""

//----------------------------------------------------------------------------//
 

Code for display of bitmaps can be simplified as above.

Still I advise you not to implement this feature. The results are not accurate.

There is something wrong inside xbrowse code, because of which we are not getting the correct row position in all cases. Let us wait till the problem in xbrowse is resolved.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Cell ToolTip

Postby ukoenig » Thu Jun 30, 2011 9:27 am

Mr. Rao,

Thank You very much for the Info.
I agree with You. It is better, to show only 100 % working Solutions.

Let us wait till the problem in xbrowse is resolved

In the meantime I found a Solution to display the Fileinfo.
Because the Browser-preview is small, I use Col 4 for the full Fileinfo, but showing only a Button.
Next I use FileNoPath of Col 4, to show after Selection only the Filename in Col 3.

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: xBrowse Cell ToolTip

Postby hua » Fri Jan 11, 2013 7:48 am

Frances/Rao, is this feature running smoothly now?
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse Cell ToolTip

Postby fraxzi » Wed Jan 16, 2013 1:19 am

Dear Hua,

Im using FWH12.05.. still not ideal.. maybe with newer FW version..
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: xBrowse Cell ToolTip

Postby hua » Wed Jan 16, 2013 1:47 am

Thanks for the feedback Frances :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 115 guests