Change Layout of content of the tooltip

Change Layout of content of the tooltip

Postby Marc Venken » 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 :

Code: Select all  Expand view


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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Change Layout of content of the tooltip

Postby cnavarro » Tue Jan 17, 2017 12:06 am

Code: Select all  Expand view

   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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Change Layout of content of the tooltip

Postby nageswaragunupudi » Tue Jan 17, 2017 2:26 am

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


Image
Regards

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

Re: Change Layout of content of the tooltip

Postby nageswaragunupudi » Tue Jan 17, 2017 2:33 am

If you want to display multi-line in both xbrowse and also in tool-tips
Code: Select all  Expand view

#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 )
 


Image
Regards

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

Re: Change Layout of content of the tooltip

Postby Marc Venken » Tue Jan 17, 2017 9: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Change Layout of content of the tooltip

Postby nageswaragunupudi » Wed Jan 18, 2017 2:41 am

Implemented and is due to be released in 17.01
Regards

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

Re: Change Layout of content of the tooltip

Postby richard-service » Wed Jan 18, 2017 5: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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Change Layout of content of the tooltip

Postby nageswaragunupudi » Wed Jan 18, 2017 6: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Change Layout of content of the tooltip

Postby nageswaragunupudi » Wed Jan 25, 2017 3: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
Code: Select all  Expand view

#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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Change Layout of content of the tooltip

Postby Horizon » 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.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Change Layout of content of the tooltip

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 119 guests