Wrong Tooltip
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Wrong Tooltip
It is possible to align a text on the left inside a tooltip
I have already tried with justLeft, Justright, pad, padright, padleft,padl,padr functions without success
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Wrong Tooltip
Silvio,
for text-adjustment You can use Chr( VK_TAB )
another test with mixed long and short text
regards
Uwe
for text-adjustment You can use Chr( VK_TAB )
Code: Select all
DEFINE BUTTON OF oBar ACTION MsgInfo( "Two" ) ;
TOOLTIP "One" + Chr( VK_TAB ) + ": Two" + CRLF + ;
"Three" + Chr( VK_TAB ) + ": Four" + SPACE(5) + CRLF + ; // force a right space
"Five" + Chr( VK_TAB ) + ": Six"
another test with mixed long and short text
Code: Select all
DEFINE BUTTON OF oBar ACTION MsgInfo( "Two" ) ;
TOOLTIP "One" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Two" + CRLF + ;
"This is a long text" + Chr( VK_TAB ) + ": Four" + SPACE(5) + CRLF + ;
"Five" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Six"
regards
Uwe
Last edited by ukoenig on Wed Apr 01, 2020 5:06 pm, edited 2 times in total.
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Wrong Tooltip
thanks I make onHand now
now I have tried with your suggestion and I must honestly say that you got it right
this is he result
good !!!
only for these value I have problems now
cTooltip += "Totale " + Chr( VK_TAB )+ ": "+ TRANSFORM( nTotal, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
cTooltip += "SubTotale" + Chr( VK_TAB )+ ": "+ TRANSFORM( nsubTotal, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
cTooltip += "Acconto" + Chr( VK_TAB )+ ": "+ TRANSFORM( nAcconto, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
cTooltip += "Da saldare"+ Chr( VK_TAB )+ ": "+ TRANSFORM( nDaSaldare, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
I tried also with my data
Any solution ?
I saw that the string are of until 8 cr it is right
sample
cTooltip = "Elemento" + Chr( VK_TAB )+ ": "+( cDescElemento)+ CRLF
cTooltip += "Numero" + Chr( VK_TAB )+ ": "+( Ltrim(str( ncella)))+ CRLF
cTooltip += "Settore" + Chr( VK_TAB )+ ": "+( cSettore)+ CRLF
cTooltip += "Ospite" + Chr( VK_TAB )+ ": "+( cCliente)+ CRLF
cTooltip += "Telefono" + Chr( VK_TAB )+ ": "+( cTelefono)+ CRLF
if the string is over 8cr then all it' s wrong
now I have tried with your suggestion and I must honestly say that you got it right
Code: Select all
cTooltip = "Elemento" + Chr( VK_TAB )+ ": "+( cDescElemento)+ CRLF
cTooltip += "Numero" + Chr( VK_TAB )+ ": "+( Ltrim(str( ncella)))+ CRLF
cTooltip += "Settore" + Chr( VK_TAB )+ ": "+( cSettore)+ CRLF
cTooltip += "Ospite" + Chr( VK_TAB )+ ": "+( cCliente)+ CRLF
cTooltip += "Telefono" + Chr( VK_TAB )+ ": "+( cTelefono)+ CRLF
good !!!
only for these value I have problems now
cTooltip += "Totale " + Chr( VK_TAB )+ ": "+ TRANSFORM( nTotal, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
cTooltip += "SubTotale" + Chr( VK_TAB )+ ": "+ TRANSFORM( nsubTotal, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
cTooltip += "Acconto" + Chr( VK_TAB )+ ": "+ TRANSFORM( nAcconto, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
cTooltip += "Da saldare"+ Chr( VK_TAB )+ ": "+ TRANSFORM( nDaSaldare, NUMPICT( 7, 2, nil, nil, nil, .t. ) ) + CRLF
I tried also with my data
Any solution ?
I saw that the string are of until 8 cr it is right
sample
cTooltip = "Elemento" + Chr( VK_TAB )+ ": "+( cDescElemento)+ CRLF
cTooltip += "Numero" + Chr( VK_TAB )+ ": "+( Ltrim(str( ncella)))+ CRLF
cTooltip += "Settore" + Chr( VK_TAB )+ ": "+( cSettore)+ CRLF
cTooltip += "Ospite" + Chr( VK_TAB )+ ": "+( cCliente)+ CRLF
cTooltip += "Telefono" + Chr( VK_TAB )+ ": "+( cTelefono)+ CRLF
if the string is over 8cr then all it' s wrong
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Wrong Tooltip
Resolved
I add space each string
the result
I add space each string
the result
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Wrong Tooltip
Silvio,
1. add ONE tab to the longest text
add 2 tabs to the short text in case the result shows different spaces
maybe 3 tabs are needed if the difference is to big between short and long text
( have a look at sample 2 )
from vkey.ch
#define VK_TAB 9 // 0x09
DEFINE BUTTON OF oBar ACTION MsgInfo( "Two" ) ;
TOOLTIP "One" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Two" + CRLF + ; // 2 tabs needed
"This is a long text" + Chr( VK_TAB ) + ": Four" + SPACE(5) + CRLF + ;
"Five" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Six"
regards
Uwe
1. add ONE tab to the longest text
add 2 tabs to the short text in case the result shows different spaces
maybe 3 tabs are needed if the difference is to big between short and long text
( have a look at sample 2 )
from vkey.ch
#define VK_TAB 9 // 0x09
DEFINE BUTTON OF oBar ACTION MsgInfo( "Two" ) ;
TOOLTIP "One" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Two" + CRLF + ; // 2 tabs needed
"This is a long text" + Chr( VK_TAB ) + ": Four" + SPACE(5) + CRLF + ;
"Five" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Six"
regards
Uwe
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Wrong Tooltip
can I reduce the space ?ukoenig wrote:Silvio,
1. add ONE tab to the longest text
add 2 tabs to the short text in case the result shows different spaces
maybe 3 tabs are needed if the difference is to big between short and long text
( have a look at sample 2 )
from vkey.ch
#define VK_TAB 9 // 0x09
DEFINE BUTTON OF oBar ACTION MsgInfo( "Two" ) ;
TOOLTIP "One" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Two" + CRLF + ; // 2 tabs needed
"This is a long text" + Chr( VK_TAB ) + ": Four" + SPACE(5) + CRLF + ;
"Five" + Chr( VK_TAB ) + Chr( VK_TAB ) + ": Six"
regards
Uwe
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Wrong Tooltip
Could it be possible to use the same logic
on TC5ToolTip
Tabs are ignored
I think the problem belongs to these sections in
CLASS TC5Tooltip FROM TWindow :
DrawText( hDC, ::cHeader2, { ::aHeader2[ 1 ] + 1, ::aHeader2[ 2 ] + 20,;
::aHeader2[ 3 ], ::aHeader2[ 4 ] - 2 }, nOR( DT_WORDBREAK, 8192 ) )
DrawText( hDC, AllTrim( ::cBody ), ::aRight,;
nOr( If( ::lRightAlignBody, DT_RIGHT, DT_LEFT ), DT_WORDBREAK ) )
DrawText( hDC, ::cFoot, { ::aFoot[ 1 ], ::aFoot[ 2 ] + 10 + nWFoot,;
::aFoot[ 3 ], ::aFoot[ 4 ] }, nOr( DT_VCENTER, DT_SINGLELINE, 8192 ) )
regards
Uwe
on TC5ToolTip
Tabs are ignored
I think the problem belongs to these sections in
CLASS TC5Tooltip FROM TWindow :
DrawText( hDC, ::cHeader2, { ::aHeader2[ 1 ] + 1, ::aHeader2[ 2 ] + 20,;
::aHeader2[ 3 ], ::aHeader2[ 4 ] - 2 }, nOR( DT_WORDBREAK, 8192 ) )
DrawText( hDC, AllTrim( ::cBody ), ::aRight,;
nOr( If( ::lRightAlignBody, DT_RIGHT, DT_LEFT ), DT_WORDBREAK ) )
DrawText( hDC, ::cFoot, { ::aFoot[ 1 ], ::aFoot[ 2 ] + 10 + nWFoot,;
::aFoot[ 3 ], ::aFoot[ 4 ] }, nOr( DT_VCENTER, DT_SINGLELINE, 8192 ) )
Code: Select all
oTip := TC5ToolTip():New( 0,0 , 250, 190, oWnd, .T. , 12976127, 12976127, CLR_BLACK, 20 , 20 )
oTip:cHeader := "Elemento" + Chr( VK_TAB ) + ": Ombrellone"
oTip:cFoot := "Prenotazione" + Chr( VK_TAB ) + ": RP200330155531"
oTip:cBody := "Elemento" + CHR( VK_TAB ) + ": Ombrellone" + CRLF + ;
"Numero" + CHR( VK_TAB ) + CHR( VK_TAB ) + ": 11" + CRLF + ;
"Setore" + CHR( VK_TAB ) + CHR( VK_TAB ) + ": A" + CRLF + ;
"Ospite" + CHR( VK_TAB ) + CHR( VK_TAB ) + ": 11" + CRLF + ;
"Telefono" + CHR( VK_TAB ) + CHR( VK_TAB ) + ": " + CRLF + ;
"Arrivo" + CHR( VK_TAB ) + CHR( VK_TAB ) + ": Lunedi, 02 Marzo 2020" + CRLF + ;
"Patenza" + CHR( VK_TAB ) + CHR( VK_TAB ) + ": Venerdi, 13 Marzo 2020" + CRLF + ;
"Giorni " +CHR( VK_TAB ) + CHR( VK_TAB ) + ": 11" + CRLF + ;
"Prenotazione" +CHR( VK_TAB ) + ": RP200330155531"
Uwe
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Wrong Tooltip
To get a structured text, I added in method
METHOD PaintBody( hDC, rc ) CLASS TC5ToolTip
DrawText( hDC, AllTrim( ::cBody ), ::aRight,;
nOr( If( ::lRightAlignBody, DT_RIGHT, DT_LEFT ), ;
DT_EXPANDTABS, DT_WORDBREAK ) )
now the < body > works the same like a standard tooltip
I still have to look for header and footer changes
regards
Uwe
METHOD PaintBody( hDC, rc ) CLASS TC5ToolTip
DrawText( hDC, AllTrim( ::cBody ), ::aRight,;
nOr( If( ::lRightAlignBody, DT_RIGHT, DT_LEFT ), ;
DT_EXPANDTABS, DT_WORDBREAK ) )
now the < body > works the same like a standard tooltip
I still have to look for header and footer changes
regards
Uwe
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Wrong Tooltip
if you try with many btnbmp with c5 tooltip class then you have many tooltips if you move the mouse over
can you try ?
here there is a test
sample test
can you try ?
here there is a test
sample test
Code: Select all
#include "Fivewin.ch"
REQUEST HB_Lang_IT
REQUEST HB_CODEPAGE_ITWIN
#define OMB_W 30
#define OMB_H 30
#define COLOR_BEACH nRGB(242,205,114)
Function Main()
SET DATE FORMAT "dd-mm-yyyy"
SET DELETED ON
SET CENTURY ON
SET EPOCH TO year( date() ) - 20
SET MULTIPLE OFF
SetBalloon( .T. )
FWNumFormat( "E", .t. )
HB_LangSelect("IT")
HB_CDPSELECT("ITWIN")
Spiaggia()
return nil
//----------------------------------------------------//
function Spiaggia()
local oSpiaggia
Local nRow:= 0
Local nCol:= 0
Local oHand:= TCursor():New(,'HAND')
local n, oBrush1,abtn,oFont
local k:= 1
local oBmp
Local numero:= OMB_W
Local nY:= 1,nX:= 1
aBtn :=array(50)
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 BOLD
DEFINE BRUSH oBrush1 COLOR COLOR_BEACH
DEFINE DIALOG oSpiaggia size 900,400 BRUSH oBrush1 ;
Title " Test Beach zoom " FONT oFont RESIZABLE
nRow := 50
nCol:= 10
For n=1 to 50
@ nRow, nCol BTNBMP aBtn[n] RESOURCE "ombrellone.png" ;
SIZE OMB_H,OMB_W PIXEL OF oSpiaggia FLAT TOP COLOR CLR_WHITE,CLR_GREEN NOBORDER
aBtn[n]:cargo := {n}
aBtn[n]:bPainted:= { |hDC,ps,oBtn|myfunc(hdc,obtn,oFont)}
aBtn[n]:lTransparent:=.t.
aBtn[n]:cToolTip := {|obtn| Fw5Tooltip(obtn,oSpiaggia) }
nCol+=OMB_W+5
k++
if k>10
nRow+=31
nCol:= 10
k:= 1
Endif
next n
Activate dialog oSpiaggia
return nil
//------------------------------------------------------------------------------------//
Function myfunc(hdc,obtn,oBold)
local ncella :=oBtn:cargo[1]
FW_SayText( hDC, ;
ltrim( str( ncella ) ), ;
{ 30, 2, 48, 25 },,oBold, CLR_WHITE, nARGB(255, nRgb(255,165,0)) , .f. )
return nil
//------------------------------------------------------------------------------------//
Function Fw5Tooltip( oCtrl ,oDlg)
Local ncella :=oCtrl:cargo[1]
local oTip
Local cHeader := " numero "+ Ltrim(str( ncella))
Local cTipo:=""
local cCliente :="Falconi Silvio"
oCtrl:cToolTip :=""
*IF lgiornaliero
cTipo:= "Giornaliero"
* else
* cTipo:= "Periodico"
*Endif
if empty(oTip)
//New( nTop, nLeft, nWidth, nHeight, oWnd, lDisenio, nClrPane, nClrPane2, nClrText, nWRadio, nHRadio ) CLASS TC5ToolTip
oTip := TC5ToolTip():New( 0,0 , 200, 150, oDlg, , CLR_HGRAY, CLR_HGRAY, CLR_BLUE, 0 , 0 )
endif
oTip:nTimer := -1 //15000
oTip:lLineHeader := .T.
oTip:cHeader := cHeader
oTip:cBmpHeader := "ombrellone.png"
oTip:cHeader2 := cCliente
oTip:lLineFoot := .T.
oTip:cFoot := "Footer"
oTip:cBmpFoot := "..\bitmaps\16object.bmp"
oTip:lSplitHdr := .T.
oTip:lLeft := .T.
oTip:cBmpLeft := "..\bitmaps\16code.bmp"
oTip:lRightAlignBody := .T.
oTip:cBody := cTipo
oTip:lBtnClose := .F. //.T.
oTip:lBorder := .F.
// oTip:lBalloon := .T.
if !oTip:IsVisible()
oTip:Show() //oppure oTip:lShowAgain := .T.
else
oTip:Hide()
endif
oCtrl:oToolTip := oTip
Return oTip
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC