FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour ejemplo c5Tooltip
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 06:59 AM
Del c贸digo inicial de c5cnew.c de Paco, quitamos una serie de funciones que correspondian estar en otro fichero, 贸 que ya estaban duplicadas. Algunas funciones se modificaron para usar todos los par谩metros disponibles. Aqui podeis ver las diferencias entre el c贸digo original de Paco y el modificado por nosotros:

https://bitbucket.org/fivetech/c5controls/commits/5ed469b2bb164a9381f3896d4872c5bc130528cd

En siguientes mensajes comentamos esas diferencias.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 07:03 AM
  • La funci贸n AnsiToWide() ya existe en FWH, asi que la quitamos de la librer铆a de Paco. La sintaxis es la misma entre la de Paco y la nuestra.

  • la funci贸n CreateCompatibleBitmap() pasa a las funciones de bitmaps de FWH. la sintaxis se mantiene.

  • Igual para la funci贸n CreateCompatibleDC()

  • La funci贸n DeleteFile() de Paco se renombr贸 a FWDeleteFile().

  • La funci贸n DrawState() se llev贸 al fichero drawing.c de FWH, pero cambiamos sus par谩metros, puesto que la de Paco ignoraba dos par谩metros que la funci贸n puede recibir. Estos cambios requieren cambios en el c贸digo PRG de Paco. Hay que revisarlos.

  • la funci贸n RoundRect() ya exist铆a en FWH, asi que se elimin贸 de la librer铆a de Paco. Ojo que la funci贸n de FWH admite un octavo par谩metro como hPen y adem谩s los par谩metros de coordenadas estan cambiados. Hay que revisar los PRGs de Paco en donde se use.

  • la funci贸n StretchBlt() estaba ya en FWH en bmpdraw.c. Los par谩metros son los mismos.

  • Se elimina la funci贸n WideToAnsi() pues ya exist铆a en FWH.

  • Se elimina la funci贸n DriveType() pues ya exist铆a en FWH la funci贸n GetDriveType() que es un wrapper a la del API de Windows.

  • Una serie de arrays publicos de bytes, los hacemos static para evitar tenerlos como p煤blicos.

  • la funci贸n ChildWindowFromPoint() estaba en FWH y con los mismos par谩metros. Se elimina la de Paco.

  • Se aplic贸 la macro HB_SYMBOL_UNUSED() en aquellos par谩metros que Paco no estaba usando para eliminar los warnings al compilar.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 07:24 AM

Revisando c5tooltip.prg se observa:

  • que no usa la funci贸n DrawState().

  • Tampoco usa la funci贸n RoundRect()

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 07:28 AM
Construyamos un ejemplo sencillo con los C5tooltips y veamos lo que ocurre:

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oWnd, oTT

   DEFINE WINDOW oWnd

   oTT = TC5Tooltip():New( 10, 10, 100, 100, oWnd )

   MsgInfo( oTT:hWnd )

   ACTIVATE WINDOW oWnd

return nil


El handle de ventana del tooltip aparece correctamente.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 07:49 AM
Bueno, ya he conseguido que se vean :-) Hay que modificar una serie de cosas:

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oWnd, oTT

   DEFINE WINDOW oWnd

   oTT = TC5Tooltip():New( 100, 100, 250, 150, oWnd, .T., CLR_CYAN, CLR_WHITE )
   
   oTT:cHeader = "header"
   oTT:cBody   = "this is the body of the tooltip" + CRLF + "It looks nice"
   oTT:cFoot   = "this is the footer"

   ACTIVATE WINDOW oWnd

return nil


regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 07:53 AM
Para que el ejemplo anterior se muestre, hay que eliminar el m茅todo Create() de la Clase TC5ToolTip de Paco.

El usa una clase predefinida "#32768" que corresponde a la clase de creaci贸n de menues de Windows:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633574(v=vs.85).aspx

Tambien hay que comentar la llamada a ::Default() que hace desde el m茅todo New(). Ah铆 trabaja con regiones, pero algo falla.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 07:56 AM

Los m茅todos Show() y Hide() llaman a sus respectivos de Super, por lo que pueden eliminarse.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 08:01 AM
Aqui teneis nuestros cambios, con los que el ejemplo mostrado funciona:

https://bitbucket.org/fivetech/c5controls/commits/c092900bc18432058f949f83980466c2ade39631
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 389
Joined: Wed Nov 29, 2006 01:51 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 10:53 AM

Antonio,
Felicitaciones, muy buena aportaci贸n...
ser铆a interesante ver un ejemplo pr谩ctico de como relacionar el c5ttip con cualquier control fwh, ej. menus, botones de buttonbar o rbar, etc.
Gracias!
Salu2, Ariel.

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 01:32 PM

Ariel,

Aun falta mucho m谩s para poder usarlos. Paco me coment贸 que sus tooltips usan la t茅cnica inicial que usaba FiveWin (nosotros cre谩bamos los tooltips, de hecho los tooltips de C5 estan basados en la misma t茅cnica que nosotros us谩bamos, pero con muchas mejoras est茅ticas), antes de que us谩semos los tooltips estandard de Windows.

Eso quiere decir que hay que volver a modificar la Clase TWindow para que soporte ambos tipos de tooltips, y eso no es algo r谩pido de hacer. Hay que buscar
cuidadosamente los sitios en donde volver a hacer esa implementaci贸n y probar que todo funcione bien.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 02:38 PM

Maestro Antonio:

Mis respetos, no hay duda que el que sabe, sabe, ayer me puse a revisar el c贸digo original y me quede liado.

Excelente trabajo, empezaremos a probar y a comentar.

Gracias Maestro por tomarse la molestia de hecharle un vistazo a este tema. :P :P :P

Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 1144
Joined: Mon Feb 05, 2007 07:15 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 04:41 PM

y porque no usar solo los toltips de paco?
se ven mas chulos,
sin de meritar los nativos jeje.
saludos.

Cesar Cortes Cruz

SysCtrl Software

Mexico



' Sin +- FWH es mejor "
Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 05:23 PM
Estoy tratando de compilar con Harbour 3.0 TC5Tooltip.prg y tengo algunos warnings y errores:

Obj\TC5Tooltip.c:
Warning W8065 TC5Tooltip.prg 574: Call to function 'IF' with no prototype in function HB_FUN_SETLAYEREDWINDOWATTRIBUTES
Error E2379 TC5Tooltip.prg 575: Statement missing ; in function HB_FUN_SETLAYEREDWINDOWATTRIBUTES
Warning W8065 TC5Tooltip.prg 644: Call to function 'IF' with no prototype in function Array2Point
Error E2379 TC5Tooltip.prg 644: Statement missing ; in function Array2Point
Warning W8070 TC5Tooltip.prg 650: Function should return a value in function Array2Point
Warning W8057 TC5Tooltip.prg 650: Parameter 'pt' is never used in function Array2Point
Warning W8065 TC5Tooltip.prg 661: Call to function 'IF' with no prototype in function HB_FUN_CREATEPOLYGONRGN
Error E2379 TC5Tooltip.prg 662: Statement missing ; in function HB_FUN_CREATEPOLYGONRGN



Aqui el c贸digo:

Code (fw): Select all Collapse
#include "fivewin.ch"

#define CW_USEDEFAULT 聽 聽 聽32768
#define SRCCOPY 13369376

#define DT_TOP 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽0x00000000
#define DT_LEFT 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 0x00000000
#define DT_CENTER 聽 聽 聽 聽 聽 聽 聽 聽 聽 0x00000001
#define DT_RIGHT 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽0x00000002
#define DT_VCENTER 聽 聽 聽 聽 聽 聽 聽 聽 聽0x00000004
#define DT_BOTTOM 聽 聽 聽 聽 聽 聽 聽 聽 聽 0x00000008
#define DT_WORDBREAK 聽 聽 聽 聽 聽 聽 聽 聽0x00000010
#define DT_SINGLELINE 聽 聽 聽 聽 聽 聽 聽 0x00000020
#define DT_EXPANDTABS 聽 聽 聽 聽 聽 聽 聽 0x00000040
#define DT_TABSTOP 聽 聽 聽 聽 聽 聽 聽 聽 聽0x00000080
#define DT_NOCLIP 聽 聽 聽 聽 聽 聽 聽 聽 聽 0x00000100
#define DT_EXTERNALLEADING 聽 聽 聽 聽 聽0x00000200
#define DT_CALCRECT 聽 聽 聽 聽 聽 聽 聽 聽 0x00000400
#define DT_NOPREFIX 聽 聽 聽 聽 聽 聽 聽 聽 0x00000800
#define DT_INTERNAL 聽 聽 聽 聽 聽 聽 聽 聽 0x00001000


CLASS TC5Tooltip FROM TWindow

聽 聽 聽 CLASSDATA lRegistered AS LOGICAL

聽 聽 聽 DATA lSplitHdr 聽 聽AS LOGICAL INIT .f.
聽 聽 聽 DATA lLeft 聽 聽 聽 聽AS LOGICAL INIT .f.

聽 聽 聽 DATA lLineHeader 聽AS LOGICAL INIT .f.
聽 聽 聽 DATA lLineFoot 聽 聽AS LOGICAL INIT .F.
聽 聽 聽 DATA lBorder 聽 聽 聽AS LOGICAL INIT .t.
聽 聽 聽 DATA lBtnClose 聽 聽AS LOGICAL INIT .f.

聽 聽 聽 DATA cHeader 聽 聽 聽AS CHARACTER INIT 聽""
聽 聽 聽 DATA cBmpLeft 聽 聽 AS CHARACTER INIT 聽""
聽 聽 聽 DATA cBody 聽 聽 聽 聽AS CHARACTER INIT 聽""
聽 聽 聽 DATA cBmpFoot 聽 聽 AS CHARACTER INIT 聽""
聽 聽 聽 DATA cFoot 聽 聽 聽 聽AS CHARACTER INIT 聽""
聽 聽 聽 DATA lRightAlignBody AS LOGICAL INIT .F.

聽 聽 聽 DATA cLibHeader
聽 聽 聽 DATA cBmpHeader
聽 聽 聽 DATA cLibLeft
聽 聽 聽 DATA cLibFoot
聽 聽 聽 DATA cTumbNail 聽 聽AS CHARACTER INIT ""
聽 聽 聽 DATA cHeader2 聽 聽 AS CHARACTER INIT 聽SPACE(255)


聽 聽 聽 DATA nClrPane2
聽 聽 聽 DATA nClrBorder 聽 AS NUMERIC INIT 0
聽 聽 聽 DATA nClrSepara1 聽AS NUMERIC INIT RGB(157,188,219)
聽 聽 聽 DATA nClrSepara2 聽AS NUMERIC INIT CLR_WHITE

聽 聽 聽 DATA nClrTextHeader
聽 聽 聽 DATA nClrTextBody
聽 聽 聽 DATA nClrTextFoot

聽 聽 聽 DATA oFontHdr
聽 聽 聽 DATA oFontHdr2
聽 聽 聽 DATA oFontBody
聽 聽 聽 DATA oFontPie

聽 聽 聽 DATA aHeader 聽 AS ARRAY INIT {0,0,0,0}
聽 聽 聽 DATA aHeader2 聽AS ARRAY INIT {0,0,0,0}
聽 聽 聽 DATA aBody 聽 聽 AS ARRAY INIT {0,0,0,0}
聽 聽 聽 DATA aLeft 聽 聽 AS ARRAY INIT {0,0,0,0}
聽 聽 聽 DATA aRight 聽 聽AS ARRAY INIT {0,0,0,0}
聽 聽 聽 DATA aFoot 聽 聽 AS ARRAY INIT {0,0,0,0}
聽 聽 聽 DATA aBtnClose AS ARRAY INIT {0,0,0,0}

聽 聽 聽 DATA nWRadio
聽 聽 聽 DATA nHRadio
聽 聽 聽 DATA nGetColor

聽 聽 聽 DATA aOldPos, nOldRow, nOldCol
聽 聽 聽 DATA hRgn
聽 聽 聽 DATA nMResize

聽 聽 聽 DATA bBmpLeft

聽 聽 聽 DATA nFixWidth
聽 聽 聽 DATA nFixHeight

聽 聽 聽 DATA bOwnerDraw

聽 聽 聽 METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, lDisenio, nClrPane, nClrPane2, nClrText, nWRadio, nHRadio ) CONSTRUCTOR
聽 聽 聽 METHOD DEFAULT ()
聽 聽 聽 METHOD Destroy() 聽INLINE ::oFontHdr :END(),;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::oFontHdr2:END(),;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::oFontBody:END(),;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::oFontPie :END(),;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽DeleteObject( ::hRgn ),;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽super:Destroy()
聽 聽 聽 METHOD EndPaint() INLINE ::nPaintCount--,EndPaint( ::hWnd, ::cPS ), ::cPS := Nil, ::hDC := Nil, 0
聽 聽 聽 METHOD DISPLAY() 聽INLINE ::BeginPaint(),::PAINT(),::EndPaint(),0
聽 聽 聽 METHOD PAINT 聽 ()
聽 聽 聽 METHOD PaintHdr ( hDC, rc )
聽 聽 聽 METHOD PaintHdr2( hDC, rc )
聽 聽 聽 METHOD PaintBody( hDC, rc )
聽 聽 聽 METHOD PaintFoot( hDC, rc )

聽 聽 聽 METHOD HandleEvent( nMsg, nWParam, nLParam )
聽 聽 聽 METHOD ReSize( nSizeType, nWidth, nHeight )
聽 聽 聽 METHOD lHeader() INLINE !EMPTY( ::cHeader )
聽 聽 聽 METHOD lFoot() 聽 INLINE !EMPTY( ::cFoot )
聽 聽 聽 METHOD GetSize()
聽 聽 聽 METHOD SetSize( nWidth, nHeight ) INLINE Super:SetSize( nWidth, nHeight, .t. )
聽 聽 聽 METHOD CREATE( cClsName )

聽 聽 聽 METHOD Show()
聽 聽 聽 METHOD Hide()

ENDCLASS


*********************************************************************************************************************************
聽 聽METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, lDisenio, nClrPane, nClrPane2, nClrText, nWRadio, nHRadio ) CLASS TC5ToolTip
*********************************************************************************************************************************

聽 聽DEFAULT nClrPane 聽:= CLR_WHITE
聽 聽DEFAULT nClrPane2 := nClrPane
聽 聽DEFAULT nClrText 聽:= 0
聽 聽DEFAULT nWRadio 聽 := 2
聽 聽DEFAULT nHRadio 聽 := 2

聽 聽::oWnd 聽 聽 聽 聽:= oWnd
聽 聽::nStyle 聽 聽 聽:= nOR( WS_POPUP )
聽 聽::nTop 聽 聽 聽 聽:= nTop
聽 聽::nLeft 聽 聽 聽 := nLeft
聽 聽::nBottom 聽 聽 := nTop + nHeight
聽 聽::nRight 聽 聽 聽:= nLeft + nWidth

聽 聽::nClrPane 聽 聽:= nClrPane
聽 聽::nClrPane2 聽 := nClrPane2
聽 聽::nClrText 聽 聽:= nClrText
聽 聽::nClrBorder 聽:= RGB( 118,118,118 )
聽 聽::nWRadio 聽 聽 := nWRadio
聽 聽::nHRadio 聽 聽 := nHRadio

聽 聽DEFINE FONT ::oFontHdr 聽 NAME "Verdana" SIZE 0, -11 BOLD
聽 聽DEFINE FONT ::oFontHdr2 聽NAME "Verdana" SIZE 0, -11
聽 聽DEFINE FONT ::oFontBody 聽NAME "Segoe UI" SIZE 0, -11
聽 聽DEFINE FONT ::oFontPie 聽 NAME "Verdana" SIZE 0, -11 BOLD

聽 聽::Register( nOR( CS_VREDRAW, CS_HREDRAW ) ) //, 131072

聽 聽::CREATE()

聽 聽::cTitle 聽 聽:= "Undefined"
聽 聽::hRgn 聽 聽 聽:= Nil

聽 聽::DEFAULT(.t.)

RETURN Self

*********************************************************************************************************************************
METHOD CREATE( cClsName ) 聽CLASS TC5ToolTip
*********************************************************************************************************************************

聽 聽DEFAULT cClsName := ::ClassName(), ::cCaption := "",;
聽 聽 聽 聽 聽 聽::nStyle := WS_OVERLAPPEDWINDOW,;
聽 聽 聽 聽 聽 聽::nTop 聽 := 0, ::nLeft := 0, ::nBottom := 10, ::nRight := 10,;
聽 聽 聽 聽 聽 聽::nId 聽 聽:= 0

聽 聽IF ::oWnd != Nil
聽 聽 聽 ::nStyle = nOR( ::nStyle, WS_CHILD )
聽 聽ENDIF

聽 聽IF ::nBottom != CW_USEDEFAULT
聽 聽 聽 ::hWnd = CreateWindow( "#32768", ::cCaption, 聽WS_POPUP ,;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::nLeft, ::nTop, ::nRight - ::nLeft + 1, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::nBottom - ::nTop + 1, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF( ::oWnd != Nil, ::oWnd:hWnd, 0 ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::nId )
聽 聽ELSE
聽 聽 聽 ::hWnd = CreateWindow( "#32768", ::cCaption, WS_POPUP, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::nLeft, ::nTop, ::nRight, ::nBottom, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF( ::oWnd != Nil, ::oWnd:hWnd, 0 ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::nId )
聽 聽ENDIF

聽 聽IF ::hWnd == 0
聽 聽 聽 WndCreateError( Self )
聽 聽ELSE
聽 聽 聽 ::Link()
聽 聽ENDIF

RETURN Nil


************************************************************************************************************************
聽METHOD GetSize() CLASS TC5ToolTip
************************************************************************************************************************

LOCAL rc 聽 聽 聽 聽:= 0
LOCAL ASIZE 聽 聽 := { 0, 0 }
LOCAL hBmp 聽 聽 聽:= 0
LOCAL hDC 聽 聽 聽 := 0
LOCAL hOldFont 聽:= 0
LOCAL n 聽 聽 聽 聽 := 0
LOCAL nHBmp 聽 聽 := 0
LOCAL nHText 聽 聽:= 0
LOCAL nHeight 聽 := 0
LOCAL nLen 聽 聽 聽:= 0
LOCAL nW 聽 聽 聽 聽:= 0
LOCAL nW2 聽 聽 聽 := 0
LOCAL nWB 聽 聽 聽 := 0
LOCAL nWBmp 聽 聽 := 0
LOCAL nWBodyTxt := 227
LOCAL nWF 聽 聽 聽 := 0
LOCAL nWH 聽 聽 聽 := 0
LOCAL nWidth 聽 聽:= 0

IF ::nFixWidth != Nil .AND. ::nFixHeight != Nil
聽 聽RETURN {::nFixWidth, ::nFixHeight}
ENDIF

rc 聽 聽 聽 聽:= GetClientRect(::hWnd)
nWidth 聽 聽:= nWBodyTxt

// Cabecera
IF !EMPTY( ::cHeader )
聽 聽nHeight += 31
聽 聽nWH := GetTextWidth( 0, ::cHeader, ::oFontHdr:hFont )+ 16
ENDIF

// Imagen a la izquierda
IF !EMPTY( ::cBmpLeft )
聽 聽hBmp := LoadImageEx( ::cBmpLeft )
ELSE
聽 聽IF ::bBmpLeft != Nil
聽 聽 聽 hBmp := EVAL( ::bBmpLeft, self )
聽 聽ENDIF
ENDIF

IF hBmp != 0
聽 聽nWBmp := BmpWidth ( hBmp )
聽 聽nHBmp := BmpHeight( hBmp )
聽 聽nWidth += ( 14 + nWBmp )
聽 聽DeleteObject( hBmp )
ENDIF

IF EMPTY(::cHeader) .AND. EMPTY(::cFoot)

聽 聽nWidth := 13 + IF( nWBmp != 0, (nWBmp+13),0) + GetTextWidth(0,::cBody,::oFontBody:hFont ) + 26

ENDIF

IF !EMPTY( ::cFoot )
聽 聽nHeight += 30
聽 聽nWF := GetTextWidth( 0, ::cFoot, ::oFontPie:hFont ) +22
ENDIF

nWidth := 聽MAX( MAX( nWidth, nWH ), nWF )

IF EMPTY(::cHeader) .AND. EMPTY(::cFoot)
聽 聽nWidth := MIN(nWidth,227)
ENDIF

// Si tenemos texto en el cuerpo del tooltip
IF !EMPTY( ::cBody )
聽 聽hDC 聽 聽 聽:= CreateDC( "DISPLAY",0,0,0)
聽 聽hOldFont := SelectObject( hDC, ::oFontBody:hFont )//
聽 聽nHText 聽 := DrawText( hDC, ALLTRIM(::cBody), { 0, 12+nWBmp+12+10, 20, nWidth }, nOr(DT_WORDBREAK, 8192, DT_CALCRECT ) )
聽 聽//nHText 聽 := DrawText( hDC, alltrim(::cBody), { 0, 6+nWBmp+12+6, 20, nWidth }, nOr(DT_WORDBREAK, 8192, DT_CALCRECT ) )
聽 聽SelectObject( hDC, hOldFont )
聽 聽DeleteDC( hDC )
聽 聽nHeight += nHText
聽 聽nHeight+=8
ENDIF

nHeight := MAX( nHeight, nHBmp )

ASIZE := { nWidth, nHeight }

RETURN ASIZE

************************************************************************************************************************
聽METHOD DEFAULT( lShowDlg ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL rc := {0, 0, ::nHeight, ::nWidth}
LOCAL hRgn
LOCAL hRgn2
LOCAL hRgn3
LOCAL o := self

DEFAULT lShowDlg := .F.

聽 聽::hRgn 聽:= CreateRoundRectRgn( rc[2] 聽,rc[1], rc[4], rc[3] , ::nWRadio, ::nHRadio )

聽 聽SetWindowRgn(::hWnd, ::hRgn, .t. )

聽 聽DeleteObject( ::hRgn )

RETURN 0

#define GW_CHILD 聽 聽 聽 聽 聽 聽 5
#define GW_HWNDNEXT 聽 聽 聽 聽 聽2

************************************************************************************************************************
聽 METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TC5Tooltip
************************************************************************************************************************

聽 IF nMsg == 20
聽 聽 聽RETURN 1
聽 ENDIF

RETURN super:HandleEvent( nMsg, nWParam, nLParam )


************************************************************************************************************************
聽 METHOD ReSize( nSizeType, nWidth, nHeight ) CLASS TC5Tooltip
************************************************************************************************************************

::DEFAULT()
::Refresh()

RETURN super:ReSize( nSizeType, nWidth, nHeight )


************************************************************************************************************************
聽METHOD PAINT() CLASS TC5ToolTip
************************************************************************************************************************
聽 LOCAL hDCMem 聽 := CreateCompatibleDC 聽 聽( ::hDC )
聽 LOCAL rc 聽 聽 聽 := GetClientRect 聽 聽 聽 聽 ( ::hWnd )
聽 LOCAL hBmpMem 聽:= CreateCompatibleBitmap( ::hDC, rc[4]-rc[2], rc[3]-rc[1] )
聽 LOCAL hOldBmp 聽:= SelectObject 聽 聽 聽 聽 聽( hDCMem, hBmpMem )
聽 LOCAL nWRadio 聽:= ::nWRadio
聽 LOCAL nHRadio 聽:= ::nHRadio
聽 LOCAL nClrText := SetTextColor( hDCMem, ::nClrText )
聽 LOCAL hBrush
聽 LOCAL hRgn 聽 聽 := CreateRoundRectRgn( rc[2] 聽,rc[1], rc[4], rc[3] , ::nWRadio, ::nHRadio )

聽 rc[3]--; rc[4]--
聽 nWRadio += 2
聽 nHRadio += 2

聽 VerticalGradient( hDCMem, {rc[1]-1,rc[2],rc[3],rc[4]}, ::nClrPane, ::nClrPane2 )

聽 IF ::bOwnerDraw == Nil

聽 聽 聽::PaintHdr ( hDCMem, rc ) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽// 聽::PaintHdr2( hDCMem, rc )
聽 聽 聽::PaintFoot( hDCMem, rc )
聽 聽 聽::PaintBody( hDCMem, rc )

聽 ELSE

聽 聽 聽EVAL( ::bOwnerDraw, hDCMem )

聽 ENDIF

聽 hBrush := CreateSolidBrush( ::nClrBorder )
聽 FrameRgn( hDCMem, hRgn, hBrush, 1, 1 )
聽 DeleteObject( hBrush )
聽 DeleteObject( hRgn )

聽 SetTextColor( hDCMem, nClrText )

聽 BitBlt( ::hDC, 0, 0, rc[4]-rc[2], rc[3]-rc[1], hDCMem, 0, 0, SRCCOPY )

聽 SelectObject( hDCMem, hOldBmp )
聽 DeleteDC 聽 聽( hDCMem )
聽 DeleteObject( hBmpMem )

RETURN 0


************************************************************************************************************************
聽 聽METHOD PaintHdr ( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL hBmpHdr
LOCAL nWBmpHdr := 0
LOCAL hOldFont
LOCAL nClrText
LOCAL lIcon := .f.
LOCAL nTop
LOCAL nMode

聽 // 25 pixels
聽 IF ::lHeader

聽 聽 聽::aHeader 聽:= {rc[1],rc[2],rc[1]+25,rc[4]}

聽 聽 聽IF !EMPTY(::cBmpHeader)
聽 聽 聽 聽 hBmpHdr := LoadImageEx( ::cBmpHeader )
聽 聽 聽 聽 IF hBmpHdr 聽!= 0
聽 聽 聽 聽 聽 聽nWBmpHdr := BmpWidth( hBmpHdr )
聽 聽 聽 聽 聽 聽nTop 聽 聽 := (::aHeader[1]+(::aHeader[3]-::aHeader[1])/2)-BmpHeight(hBmpHdr)/2
聽 聽 聽 聽 聽 聽nTop 聽 聽 := MAX( nTop, 5)
聽 聽 聽 聽 聽 聽DrawMasked( hDC, hBmpHdr, nTop , 5 )
聽 聽 聽 聽 聽 聽DeleteObject( hBmpHdr )
聽 聽 聽 聽 ENDIF
聽 聽 聽ENDIF

聽 聽 聽hOldFont := SelectObject( hDC, ::oFontHdr:hFont )
聽 聽 聽IF ::nClrTextHeader != Nil
聽 聽 聽 聽 nClrText := SetTextColor( hDC, ::nCLrTextHeader )
聽 聽 聽ENDIF
聽 聽 聽nMode := SetBkMode( hDC, 1 )

聽 聽 聽DrawText( hDC, ::cHeader, {::aHeader[1],::aHeader[2]+10+IF(hBmpHdr!=0,nWBmpHdr,0),::aHeader[3],::aHeader[4]-10},nOr( DT_VCENTER, DT_SINGLELINE, 8192 ) )

聽 聽 聽SetBkMode( hDC, nMode )

聽 聽 聽IF ::nClrTextHeader != Nil
聽 聽 聽 聽 SetTextColor( hDC, nClrText )
聽 聽 聽ENDIF

聽 聽 聽SelectObject( hDC, hOldFont )
聽 ELSE
聽 聽 聽::aHeader 聽:= {rc[1],rc[2],rc[1],rc[4]}
聽 ENDIF
RETURN 0

************************************************************************************************************************
聽 聽METHOD PaintHdr2( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL hOldFont
LOCAL nClrText

聽 ::aHeader2 := {::aHeader[3],rc[2],::aHeader[3],rc[4]}
聽 IF ::lHeader

聽 聽 聽IF ::lSplitHdr
聽 聽 聽 聽 ::aHeader2 := {::aHeader[3],rc[2],::aHeader[3]+25,rc[4]}
聽 聽 聽ENDIF

聽 聽 聽IF ::lLineHeader
聽 聽 聽 聽 Line( hDC, ::aHeader2[3] 聽, ::aHeader2[2]+5, ::aHeader2[3] 聽, ::aHeader2[4]-5, ::nClrSepara1 )
聽 聽 聽 聽 Line( hDC, ::aHeader2[3]+1, ::aHeader2[2]+5, ::aHeader2[3]+1, ::aHeader2[4]-5, ::nClrSepara2 )
聽 聽 聽ENDIF

聽 聽 聽hOldFont := SelectObject( hDC, ::oFontHdr2:hFont )
聽 聽 聽IF ::nClrTextHeader != Nil
聽 聽 聽 聽 nClrText := SetTextColor( hDC, ::nCLrTextHeader )
聽 聽 聽ENDIF
聽 聽 聽IF ::lSplitHdr .AND. !EMPTY( ::cHeader2 )
聽 聽 聽 聽 DrawText( hDC, ::cHeader2, {::aHeader2[1]+1,::aHeader2[2]+20,::aHeader2[3],::aHeader2[4]-2}, nOR(DT_WORDBREAK, 8192) )
聽 聽 聽ENDIF
聽 聽 聽IF ::nClrTextHeader != Nil
聽 聽 聽 聽 SetTextColor( hDC, nClrText )
聽 聽 聽ENDIF
聽 聽 聽SelectObject( hDC, hOldFont )
聽 ENDIF

RETURN 0


************************************************************************************************************************
聽 聽METHOD PaintBody( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************

聽 聽LOCAL hOldFont
聽 聽LOCAL nWBmp := 0
聽 聽LOCAL nClrText
聽 聽LOCAL lIcon := .f.
聽 聽LOCAL nMode
聽 聽LOCAL hBmpLeft := 0
聽 聽LOCAL n
聽 聽LOCAL nLen
聽 聽LOCAL nW
聽 聽LOCAL nW2
聽 聽LOCAL aLeft

聽 聽::aLeft := {0,0,0,0}

聽 聽::aBody 聽 聽:= {::aHeader[3],rc[2],::aFoot[1],rc[4]}

聽 聽IF EMPTY(::cBmpLeft)
聽 聽 聽 ::aLeft 聽 := {::aBody[1],rc[2],::aBody[3],IF(::lLeft,(rc[4]-rc[2])*0.33,rc[2])}
聽 聽ELSE
聽 聽 聽 hBmpLeft := LoadImageEx( ::cBmpLeft )
聽 聽 聽 IF hBmpLeft != 0
聽 聽 聽 聽 聽nWBmp := BmpWidth( hBmpLeft )
聽 聽 聽 聽 聽::aLeft 聽 := { ::aBody[1],rc[2],::aBody[3],12+nWBmp+12}
聽 聽 聽 ENDIF
聽 聽ENDIF

聽 聽IF ::bBmpLeft != Nil
聽 聽 聽 hBmpLeft := EVAL( ::bBmpLeft, self )
聽 聽 聽 IF hBmpLeft != 0
聽 聽 聽 聽 聽nWBmp := BmpWidth( hBmpLeft )
聽 聽 聽 聽 聽::aLeft 聽 := { ::aBody[1],rc[2],::aBody[3],12+nWBmp+12}
聽 聽 聽 ENDIF
聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 //
聽 聽::aRight 聽:= {::aBody[1] +3,::aLeft[4]+20,::aBody[3]-3,rc[4]-10}

聽 聽hOldFont := SelectObject( hDC, ::oFontBody:hFont )

聽 聽nMode := SetBkMode( hDC, 1 )

聽 聽DrawText( hDC,ALLTRIM(::cBody), ::aRight, nOr(IF( ::lRightAlignBody,DT_RIGHT,DT_LEFT), DT_WORDBREAK ) )

聽 聽SetBkMode( hDC, nMode )

聽 聽SelectObject( hDC, hOldFont )

聽 聽IF hBmpLeft != 0
聽 聽 聽 DrawMasked( hDC, hBmpLeft, ::aLeft[1]+5, ::aLeft[2]+12 )
聽 聽 聽 DeleteObject( hBmpLeft )
聽 聽ENDIF

RETURN 0

************************************************************************************************************************
聽 聽METHOD PaintFoot( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************
聽 LOCAL hOldFont, hBmpFoot
聽 LOCAL nWFoot := 0
聽 LOCAL nClrText
聽 LOCAL lIcon := .f.
聽 LOCAL nMode

聽 IF ::lFoot
聽 聽 聽::aFoot := {rc[3]-30,rc[2],rc[3],rc[4]}
聽 聽 聽IF !EMPTY(::cBmpFoot)
聽 聽 聽 聽 ::aFoot := {rc[3]-30,rc[2],rc[3],rc[4]}
聽 聽 聽ENDIF
聽 聽 聽hBmpFoot := LoadImageEx( ::cBmpFoot )
聽 聽 聽IF hBmpFoot != 0
聽 聽 聽 聽 nWFoot := BmpWidth( hBmpFoot )
聽 聽 聽 聽 ::aFoot := {rc[3]-30,rc[2],rc[3],rc[4]}
聽 聽 聽 聽 DrawMasked( hDC, hBmpFoot, (::aFoot[1]+(::aFoot[3]-::aFoot[1])/2)-BmpHeight(hBmpFoot)/2, 5 )
聽 聽 聽 聽 DeleteObject( hBmpFoot )
聽 聽 聽ENDIF
聽 ELSE
聽 聽 聽::aFoot := {rc[3],rc[2],rc[3],rc[4]}
聽 ENDIF

聽 IF ::lFoot
聽 聽 聽hOldFont := SelectObject( hDC, ::oFontPie:hFont )
聽 聽 聽IF ::nClrTextFoot != Nil
聽 聽 聽 聽 nClrText := SetTextColor( hDC, ::nClrTextFoot )
聽 聽 聽ENDIF
聽 聽 聽nMode := SetBkMode( hDC, 1 )
聽 聽 聽DrawText( hDC, ::cFoot, {::aFoot[1],::aFoot[2]+ 10+nWFoot,::aFoot[3],::aFoot[4]},nOr( DT_VCENTER, DT_SINGLELINE, 8192 ) )
聽 聽 聽SetBkMode( hDC, nMode )
聽 聽 聽IF ::nClrTextFoot != Nil
聽 聽 聽 聽 SetTextColor( hDC, nClrText )
聽 聽 聽ENDIF
聽 聽 聽SelectObject( hDC, hOldFont )
聽 ENDIF

聽 Line( hDC, ::aFoot[1] 聽, ::aFoot[2]+5, ::aFoot[1] 聽, ::aFoot[4]-5, ::nClrSepara1 )
聽 Line( hDC, ::aFoot[1]+1, ::aFoot[2]+5, ::aFoot[1]+1, ::aFoot[4]-5, ::nClrSepara2 )

RETURN 0


*********************************************************************************************
聽 METHOD Hide() CLASS TC5Tooltip
*********************************************************************************************

RETURN super:Hide()

#define WS_EX_LAYERED 聽 聽524288
#define GWL_EXSTYLE 聽 聽 聽 聽 -20
#define LWA_ALPHA 聽 聽 聽 聽 聽 聽 2

*********************************************************************************************
聽 METHOD Show() CLASS TC5Tooltip
*********************************************************************************************

RETURN super:Show()


/*
////////////////////////////////////////////////////////////////////
聽 function LoadImageEx2( cImage, hBmp )
////////////////////////////////////////////////////////////////////
local lIcon := .f.

聽hBmp := LoadImageEx( cImage )
聽if hBmp == 0
聽 聽 hBmp := LoadIcon( GetResources(), cImage )
聽 聽 if hBmp == 0
聽 聽 聽 聽hBmp := ExtractIcon( cImage )
聽 聽 聽 聽lIcon := hBmp != 0
聽 聽 else
聽 聽 聽 聽lIcon := .t.
聽 聽 endif
聽endif

return lIcon
*/

/***************************************************************************************************************************/
聽 聽FUNCTION Line( hDC, nTop, nLeft, nBottom, nRight, nColor, nGrueso )
/***************************************************************************************************************************/
LOCAL hPen, hOldPen
DEFAULT nGrueso := 1
DEFAULT nColor := CLR_BLACK

hPen := CreatePen( PS_SOLID, nGrueso, nColor )
hOldPen := SelectObject( hDC, hPen )
MoveTo( hDC, nLeft, 聽nTop 聽 聽)
LineTo( hDC, nRight, nTop 聽 聽)
SelectObject( hDC, hOldPen )
DeleteObject( hPen )

RETURN 0


#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"

//lngUser32 = LoadLibrary("User32.dll")
//lngSetLayeredWindowAttributes = GetProcAddress(lngUser32, "SetLayeredWindowAttributes")
//If lngSetLayeredWindowAttributes <> 0 Then
//' Set window translucency, if supported
//lngOldStyle = GetWindowLong(hDlg, %GWL_EXSTYLE)
//SetWindowLong hDlg, %GWL_EXSTYLE, lngOldStyle Or %WS_EX_LAYERED
//Call DWord lngSetLayeredWindowAttributes Using SetLayeredWindowAttributes(hDlg, 0, %TRANSLEVEL, %LWA_ALPHA)
//End If

typedef BOOL 聽( FAR PASCAL 聽*LPSETLAYEREDWINDOWATTRIBUTES) ( HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags );

HB_FUNC( SETLAYEREDWINDOWATTRIBUTES )
{

聽 HINSTANCE hLib;

聽 LPSETLAYEREDWINDOWATTRIBUTES SetLayeredWindowAttributes;
聽 hLib = LoadLibrary( "user32.dll" );
聽 IF ( hLib )
聽 {
聽 聽 聽 SetLayeredWindowAttributes = (LPSETLAYEREDWINDOWATTRIBUTES) GetProcAddress( hLib, "SetLayeredWindowAttributes" );
聽 聽 聽 IF( SetLayeredWindowAttributes )
聽 聽 聽 {
聽 聽 聽 聽 聽 SetLayeredWindowAttributes( ( HWND ) 聽 聽 hb_parnl( 1 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( COLORREF ) hb_parnl( 2 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( BYTE ) 聽 聽 hb_parni ( 3 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( DWORD ) 聽 聽hb_parnl( 4 ) );
聽 聽 聽 }
聽 聽 聽 FreeLibrary( hLib );
聽 }

聽 hb_ret();
}


/*
HB_FUNC( CREATERECTRGN )
{
聽 聽 hb_retnl( (long) CreateRectRgn( hb_parni( 1 ),hb_parni( 2 ),hb_parni( 3 ),hb_parni( 4 )));

}
*/

/*
HB_FUNC( CREATEROUNDRECTRGN )
{
聽 聽hb_retnl( (long) CreateRoundRectRgn( hb_parni( 1 ),hb_parni( 2 ),hb_parni( 3 ),hb_parni( 4 ),hb_parni( 5 ),hb_parni( 6 )));
}

HB_FUNC( CREATEELLIPTICRGN )
{
聽 聽hb_retnl( (long) CreateEllipticRgn( hb_parni( 1 ),hb_parni( 2 ),hb_parni( 3 ),hb_parni( 4 )));
}

HB_FUNC( COMBINERGN )
{
聽 聽HRGN hrgn = CreateRectRgn(0,0,0,0);
聽 聽HRGN hrgn1 = (HRGN) hb_parnl( 1 );
聽 聽HRGN hrgn2 = (HRGN) hb_parnl( 2 );
聽 聽int iRet;

聽 聽iRet = CombineRgn( hrgn, 聽 聽 聽// handle to destination region
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 hrgn1, 聽 聽 聽// handle to source region
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 hrgn2, 聽 聽 聽// handle to source region
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 hb_parni( 3 ) 聽 聽 聽 // region combining mode
聽 聽 聽 聽 聽 聽 聽);


聽 聽hb_retni( (long)hrgn );


}
*/

/*
HB_FUNC( SETWINDOWRGN )
{
聽 hb_retni( SetWindowRgn( (HWND) hb_parnl( 1 ),(HRGN) hb_parnl( 2 ), hb_parl( 3 ) ));
}
*/

HB_FUNC( FRAMERGN )
{
聽 聽hb_retl( FrameRgn( (HDC) hb_parnl( 1 ), (HRGN) hb_parnl( 2 ), (HBRUSH) hb_parnl( 3 ), hb_parni( 4 ), hb_parni( 5 )));
}

BOOL Array2Point(PHB_ITEM aPoint, POINT *pt )
{
聽 聽IF (HB_IS_ARRAY(aPoint) && hb_arrayLen(aPoint) == 2) {
聽 聽 聽 pt->x = hb_arrayGetNL(aPoint,1);
聽 聽 聽 pt->y = hb_arrayGetNL(aPoint,2);
聽 聽 聽 RETURN TRUE ;
聽 聽}
聽 聽RETURN FALSE;
}

HB_FUNC( CREATEPOLYGONRGN )
{
聽 聽POINT * Point ;
聽 聽POINT pt ;
聽 聽INT iCount ;
聽 聽INT i ;
聽 聽PHB_ITEM aParam ;
聽 聽PHB_ITEM aSub ;

聽 聽IF ( hb_param( 1, HB_IT_ARRAY ) != NULL )
聽 聽{
聽 聽 聽 聽iCount = (INT) hb_parinfa( 1, 0 ) ;
聽 聽 聽 聽Point = (POINT *) hb_xgrab( iCount * sizeof (POINT) ) ;
聽 聽 聽 聽aParam = hb_param(1,HB_IT_ARRAY);

聽 聽 聽 聽FOR ( i = 0 ; i<iCount ; i++ )
聽 聽 聽 聽{
聽 聽 聽 聽 聽 aSub = ( PHB_ITEM ) hb_itemArrayGet( aParam, i+1 );

聽 聽 聽 聽 聽 IF ( Array2Point(aSub, &pt ))
聽 聽 聽 聽 聽 聽 聽 聽*(Point+i) = pt ;
聽 聽 聽 聽 聽 ELSE {
聽 聽 聽 聽 聽 聽 hb_retnl(0);
聽 聽 聽 聽 聽 聽 hb_xfree(Point);
聽 聽 聽 聽 聽 聽 RETURN ;
聽 聽 聽 聽 聽 }
聽 聽 聽 聽}

聽 聽 聽 聽hb_retnl( (LONG) CreatePolygonRgn( Point, iCount, hb_parni( 2 ) ) ) ;
聽 聽 聽 聽hb_xfree(Point);

聽 聽}
聽 聽ELSE
聽 聽 hb_retnl( 0 );

}

HB_FUNC( GETDLGCTRLID )
{
聽 聽hb_retni( GetDlgCtrlID( ( HWND ) hb_parnl( 1 ) ) );
}




#pragma ENDDUMP
Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 05:45 PM

Viktor,

Estos IF tienen que estar en minusculas:

IF ( hLib )

No pierdas tu tiempo en pelearte con esto, deja que nosotros lo solucionemos y luego los usaras comodamente :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: ejemplo c5Tooltip
Posted: Fri Sep 13, 2013 07:46 PM
Antonio,
Perhaps I found the modify to show it for any seconds


ADD THESE DATA
DATA oTimer, nTimer

AND CHANGE THE PAINT METHOD

Code (fw): Select all Collapse
 METHOD Paint() CLASS TC5ToolTip
************************************************************************************************************************
聽 local hDCMem 聽 := CreateCompatibleDC 聽 聽( ::hDC )
聽 local rc 聽 聽 聽 := GetClientRect 聽 聽 聽 聽 ( ::hWnd )
聽 local hBmpMem 聽:= CreateCompatibleBitmap( ::hDC, rc[4]-rc[2], rc[3]-rc[1] )
聽 local hOldBmp 聽:= SelectObject 聽 聽 聽 聽 聽( hDCMem, hBmpMem )
聽 local nWRadio 聽:= ::nWRadio
聽 local nHRadio 聽:= ::nHRadio
聽 local nClrText := SetTextColor( hDCMem, ::nClrText )
聽 local hBrush
聽 local hRgn 聽 聽 := CreateRoundRectRgn( rc[2] 聽,rc[1], rc[4], rc[3] , ::nWRadio, ::nHRadio )
聽 Local oThis := self

聽 rc[3]--; rc[4]--
聽 nWRadio += 2
聽 nHRadio += 2

聽 聽 IF ::oTimer != nil
聽 聽::oTimer:Deactivate()
endif

DEFINE 聽 TIMER ::oTimer INTERVAL ::nTimer ACTION oThis:Hide() OF Self
ACTIVATE TIMER ::oTimer




聽 VerticalGradient( hDCMem, {rc[1]-1,rc[2],rc[3],rc[4]}, ::nClrPane, ::nClrPane2 )

聽 if ::bOwnerDraw == nil

聽 聽 聽::PaintHdr ( hDCMem, rc ) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽// 聽::PaintHdr2( hDCMem, rc )
聽 聽 聽::PaintFoot( hDCMem, rc )
聽 聽 聽::PaintBody( hDCMem, rc )

聽 else

聽 聽 聽eval( ::bOwnerDraw, hDCMem )

聽 endif



聽 hBrush := CreateSolidBrush( ::nClrBorder )
聽 FrameRgn( hDCMem, hRgn, hBrush, 1, 1 )
聽 DeleteObject( hBrush )
聽 DeleteObject( hRgn )

聽 SetTextColor( hDCMem, nClrText )

聽 BitBlt( ::hDC, 0, 0, rc[4]-rc[2], rc[3]-rc[1], hDCMem, 0, 0, SRCCOPY )

聽 SelectObject( hDCMem, hOldBmp )
聽 DeleteDC 聽 聽( hDCMem )
聽 DeleteObject( hBmpMem )

return 0




THEN TRY THIS TEST.PTH
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

聽 聽local oWnd, oTT

聽 聽DEFINE WINDOW oWnd

聽 聽oTT = TC5Tooltip():New( 100, 100, 450, 350, oWnd, .T., CLR_CYAN, CLR_WHITE,15,15 )
聽 聽
聽 聽oTT:cHeader = "header"
聽 聽oTT:cHeader2 = "header2"
聽 聽oTT:cBody 聽 = "this is the body of the tooltip" + CRLF + "It looks nice"
聽 聽oTT:cFoot 聽 = "this is the footer"
聽 聽oTT:cBmpFoot :=".\bitmaps\help2.bmp"
聽 聽oTT:cBmpLeft :=".\bitmaps\brush.bmp"
聽 * oTT:lRightAlignBody:=.t.

聽 聽 聽 oTT:lLineHeader 聽:=.t. 聽 //not run
聽 聽oTT:lBtnClose :=.t. 聽 聽 聽 聽 //not run
聽 聽oTT:lSplitHdr:=.t. 聽 聽 聽 聽 聽//not run
聽 聽 oTT:lBorder :=.f.

聽 聽 oTT:nTimer:= 2000

聽 聽 聽ACTIVATE WINDOW oWnd

return nil




nOW i SAW IT THERE WAS ON OLDEST VERSION C5TIP.PRG
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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