Wrong Tooltip
Posted: Fri Mar 27, 2020 11:04 pm
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
www.FiveTechSoft.com
https://fivetechsoft.com/forums/
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"
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"
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
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
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"
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