Wrong Tooltip

Wrong Tooltip

Postby Silvio.Falconi » Fri Mar 27, 2020 11:04 pm

Image Image

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: Wrong Tooltip

Postby ukoenig » Sat Mar 28, 2020 9:14 am

Silvio,

for text-adjustment You can use Chr( VK_TAB )

Code: Select all  Expand view

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"
 


Image

Image

another test with mixed long and short text

Code: Select all  Expand view

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"
 


Image

regards
Uwe :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Wrong Tooltip

Postby Silvio.Falconi » Sat Mar 28, 2020 5:03 pm

thanks I make onHand now

Image
now I have tried with your suggestion and I must honestly say that you got it right

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


this is he result

Image

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


Image

I tried also with my data

Image

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: Wrong Tooltip

Postby Silvio.Falconi » Sat Mar 28, 2020 5:57 pm

Resolved
I add space each string

the result


Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: Wrong Tooltip

Postby ukoenig » Sat Mar 28, 2020 9:25 pm

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 :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Wrong Tooltip

Postby nageswaragunupudi » Sun Mar 29, 2020 3:21 pm

Uwe
Nice solution !!!
Regards

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

Re: Wrong Tooltip

Postby Silvio.Falconi » Mon Mar 30, 2020 1:23 pm

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 :D


can I reduce the space ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: Wrong Tooltip

Postby ukoenig » Wed Apr 01, 2020 5:08 pm

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


Image

Code: Select all  Expand view

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"
 


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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Wrong Tooltip

Postby ukoenig » Thu Apr 02, 2020 7:52 am

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 :roll:

Image

regards
Uwe :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Wrong Tooltip

Postby Silvio.Falconi » Thu Apr 02, 2020 9:38 pm

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


Image


sample test
Code: Select all  Expand view
#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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 93 guests