Implemented and is due to be released in 17.01
G. N. Rao.
Hyderabad, India
Implemented and is due to be released in 17.01
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 ) local cTags := "Iphone<br>64mb<br>green<br>touchscreen"
local cStr := ""
local aStr := {}
aStr := HB_ATokens( cTags, "<br>")
aEVal( aStr, { | a | cStr += a + CRLF } )
? cStrfunction 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 uValIf 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 )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
nageswaragunupudi wrote:Implemented and is due to be released in 17.01
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.
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 nilHi Mr. Rao,
Can we set duration time in bCellToolTip usage?
Thanks,
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