FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Change Layout of content of the tooltip
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Change Layout of content of the tooltip
Posted: Mon Jan 16, 2017 11:16 PM

Hello,

I a browse I have a Char Field. It look like : "Iphone<br>64mb<br>green<br>touchscreen" enz..

It is used for a import in a php shopcart, where the <BR> will take care that each item is on a new line for viewing.

I would like tho see also from the browse and his Tooltip the Items on each new line

Iphone
64 mb
Green
Touchscreen

I tried to change the <BR> what is HTML inside the below function to CRLF , but with no succes.

Maybe a other idea ?

This code shows the tooltip :

from browse :
  oBrw:bToolTips   := ;
        { | 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 )
      uVal  := oMouseCol:Value
      oBrw:BookMark := uBm
   else
      uVal  := oMouseCol:Value
   endif

return cValToChar( uVal )
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Change Layout of content of the tooltip
Posted: Tue Jan 17, 2017 12:06 AM
   local cTags    := "Iphone<br>64mb<br>green<br>touchscreen" 
   local cStr    := ""
   local aStr    := {}
   
   aStr := HB_ATokens( cTags, "<br>")
   aEVal( aStr, { | a | cStr += a + CRLF } )
   ? cStr
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Change Layout of content of the tooltip
Posted: Tue Jan 17, 2017 02:26 AM
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

   uVal     := cValToChar( uVal )
   uVal     := StrTran( uVal, "<br>", CRLF )


return uVal

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Change Layout of content of the tooltip
Posted: Tue Jan 17, 2017 02:33 AM

If you want to display multi-line in both xbrowse and also in tool-tips

#include "fivewin.ch"

function Main()

   local oDlg, oBrw, oFont
   local aData := { ;
     { 1,  "Iphone<br>64mb<br>green<br>touchscreen" }, ;
     { 2,  "brand2<br>32mb<br>black<br>touchscreen" }, ;
     { 3,  "brand3<br>16mb<br>white<br>touchscreen" }  }

   SetBalloon( .T. )
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 300,400 PIXEL FONT oFont TRUEPIXEL

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE aData COLUMNS 1, 2 ;
      COLSIZES 50,100 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :aCols[ 2 ]:bEditValue := { || StrTran( oBrw:aRow[ 2 ], "<br>", CRLF ) }
      :nDataLines := 4
      :bToolTips := { | oBrw,r,c,f,oMouseCol,nMouseRow| MyColToolTip( oBrw,r,c,f,oMouseCol,nMouseRow ) }
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

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 )

Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Change Layout of content of the tooltip
Posted: Tue Jan 17, 2017 09:17 PM
Thank you all.

I found a post that it is not yet possible to keep the Tooltip Balloon longer on screen

Options :

1 by time : we can set the time, or
2 Keep visible as long as we are on the cell, and change when we change to a other cell.

Is this also for Xbrowse ? Maybe Xbrowse has this option inside...

nageswaragunupudi wrote:For many years it is already possible to set title, icon and colors of tooltip.

Obj:cToolTip can be assigned with Text or Array or CodeBlock. Codeblock can return either text or array
Advantage of codeblock is that we can change the text,etc displayed according to the context at the time of display of tooltip.

Array Specs:
Obj:cToolTip := { cText, cTitle, nIcon, nClrText, nClrBack }


March 2008
===========
* Enhancement: Tooltips can now have user defined header, icon and colors,
by specifying the tooltip as an array in the format
{ cToolTipText, [cHeader, [nIcon]], [nForeColor], [nBackColor] }.
If the tooltip is specified as a codeblock, it can evaluate to a
character value or an array.


Now we shall consider adding width, delaytype and delaytime
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Change Layout of content of the tooltip
Posted: Wed Jan 18, 2017 02:41 AM

Implemented and is due to be released in 17.01

Regards



G. N. Rao.

Hyderabad, India
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: Change Layout of content of the tooltip
Posted: Wed Jan 18, 2017 05:55 AM
nageswaragunupudi wrote:Implemented and is due to be released in 17.01

Mr.Rao
How about use C5ToolTip?
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Change Layout of content of the tooltip
Posted: Wed Jan 18, 2017 06:10 AM

You are free to use C5ToolTip class if you like. It offers more flexibility. This is a class independent of Windows API. Each tooltip involves writing of more code.

The tooltips we discussed earlier were tooltips provided by Windows API and usage is simple.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Change Layout of content of the tooltip
Posted: Wed Jan 25, 2017 03:44 PM

In FWH 17.01, we introduced bCellToolTip, which is extremely easier to implement than bToolTip. We recommend using bCellToolTip in the place of bToolTip and deprecate using bToolTip.

The sample above is re-written using bCellToolTip

#include "fivewin.ch"

function Main()

   local oDlg, oBrw, oFont
   local aData := { ;
     { 1,  "Iphone<br>64mb<br>green<br>touchscreen" }, ;
     { 2,  "brand2<br>32mb<br>black<br>touchscreen" }, ;
     { 3,  "brand3<br>16mb<br>white<br>touchscreen" }  }

   SetBalloon( .T. )
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 300,400 PIXEL FONT oFont TRUEPIXEL

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE aData COLUMNS 1, 2 ;
      COLSIZES 50,100 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :aCols[ 2 ]:bEditValue := { || StrTran( oBrw:aRow[ 2 ], "<br>", CRLF ) }
      :nDataLines := 4
      :bCellToolTips := { | oCol | cValToChar( oCol:Value ) }
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: Change Layout of content of the tooltip
Posted: Thu Jan 26, 2017 11:27 AM

Hi Mr. Rao,

Can we set duration time in bCellToolTip usage?

Thanks,

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Change Layout of content of the tooltip
Posted: Thu Jan 26, 2017 12:07 PM

Yes, from FWH 17.01 onwards.
In the above codeblock instead of returning a character value, return array with 7th element as time in milliseconds.
For complete specification, please see whatsnew.txt of FWH 17.01

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion