MSGItem 2007

Moderator: Enrico Maria Giordano

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

MSGItem 2007

Post by Silvio »

Avevo fatto una piccola modifica sul vecchio msgitem per non vedere i item incavati per questione di estetica infatti avevo modificato nel metodo paint solo la riga :

WndBoxRaised( hDC, 0, nLeft - 4, 22, nLeft + ::nWidth -1)

anzichè

WndBoxIn( hDC, 3, nLeft - 2, ::oMsgBar:nHeight-5, nLeft + ::nWidth - 6 )

il mio problema è adesso che i text li scrive sul fondo bianco ma ho visto che la classe originale lo fa lo stesso anche se crea un Box raised cioè incavato

come posso fare per scrivere il testo in trasparenza cioè senza lo sfondo bianco ?

grazie
Best Regards, Saludos

Falconi Silvio
User avatar
Enrico Maria Giordano
Posts: 8778
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: MSGItem 2007

Post by Enrico Maria Giordano »

Prova a mettere

SetBkMode( hDC, 1 )

prima della chiamata a DrawMsgItem(). Se non funziona allora ci vuole Antonio.

EMG
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Mi ero perso a vedere ppc ...solo oggi hoprovato ma non succede niente


METHOD Paint() CLASS TMsgItem

local nCount, nClrBack
local nLeft := ::nLeft()
local hBmp, nBmpWidth := 0
local hDC := ::oMsgBar:GetDC()

if ::hBitmap1 != nil
hBmp = If( ::lActive, ::hBitmap1, ;
If( ::hBitmap2 != nil, ::hBitmap2, ::hBitmap1 ) )
nBmpWidth = nBmpWidth( hBmp )
DrawMasked( hDC, hBmp, 4, nLeft + 1 )
endif

DrawMsgItem( hDC, ::cMsg,;
{ 5, nLeft + nBmpWidth, ::oMsgBar:nHeight-6, nLeft + ( ::nWidth - 7 ) },;
If( ::lActive, ::nClrText, ::nClrDisabled ),;
::nClrPane, ::oFont:hFont )
* WndBoxIn( hDC, 3, nLeft - 2, ::oMsgBar:nHeight-5, nLeft + ::nWidth - 6 )
SetBkMode( hDC, 1 )
WndBoxRaised( hDC, 0, nLeft - 4, 22, nLeft + ::nWidth -1)
::oMsgBar:ReleaseDC()

return nil
Image
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

l'ho messo anche prima di DrawMsgItem ma non accade niente....

Image
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

ENRICO,

adesso l'ho chiesto a Linares...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Enrico nell 'ultima versione il problema non è stato corretto
ho messo il messaggio anche sul forum inglese
inoltre ho l'impressione che tutti sono spariti .... già in vacanze natalizie ?
Best Regards, Saludos

Falconi Silvio
User avatar
Enrico Maria Giordano
Posts: 8778
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 8 times
Contact:

Post by Enrico Maria Giordano »

Andrebbe modificata la funzione DrawMsgItem(). Prova magari a sostituirla con il metodo Say() specificando a .T. il parametro lTrasparent.

EMG
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Si però... Antonio mi disse che l'avrebbe corretto nella 7.12 !!!!
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

ok corretto quasi tutto :

Code: Select all | Expand

#include "FiveWin.ch"#ifdef __XPP__   #define New   _New#endif//----------------------------------------------------------------------------//// MODIFIED BY FALCONI SILVIO &  Nageswaragunupudi // NOT  remove this CLASS TMsgItem   DATA   oMsgBar   DATA   cMsg   DATA   nWidth, nClrText, nClrPane, nClrDisabled   DATA   bMsg, bAction   DATA   oFont   DATA   lActive, lTimer AS LOGICAL   DATA   lWasActive   DATA   hBitmap1, hPalette1   DATA   hBitmap2, hPalette2   DATA   cToolTip   METHOD New( oMsgBar, cMsg, nWidth, oFont, nClrText, nClrBack, lAdd,;               bAction, cBmp1, cBmp2, cToolTip ) CONSTRUCTOR   METHOD Refresh()   METHOD SetFont( oFont ) INLINE ::oFont:End(), ::oFont := oFont   METHOD Paint()   METHOD SetText( cMsg ) INLINE ::cMsg := cValToChar( cMsg ), ::Paint()   METHOD Click( nRow, nCol ) INLINE If( ::bAction != nil, Eval( ::bAction, nRow, nCol ),)   METHOD IsOver( nRow, nCol )   METHOD nLeft()ENDCLASS//----------------------------------------------------------------------------//METHOD New( oMsgBar, cMsg, nWidth, oFont, nClrText, nClrBack, lAdd, bAction,;            cBmp1, cBmp2, cToolTip ) CLASS TMsgItem   #ifdef __XPP__      #undef New   #endif   DEFAULT nClrText := oMsgBar:nClrText,;           nClrBack := oMsgBar:nClrPane,;           lAdd := .f., cMsg := "", cToolTip := ""   ::oMsgBar = oMsgBar   ::cMsg    = cMsg   ::oFont   = If( oFont != nil, oFont, ::oMsgBar:oFont )   ::bAction = bAction   ::lActive = .t.   ::lWasActive = .t.   ::lTimer  = .f.   ::cToolTip = cToolTip   if Valtype( nClrText ) == "C"      ::nClrText := nGetForeRGB( nClrText )      ::nClrPane := nGetBackRGB( nClrText )   else      ::nClrText := nClrText      ::nClrPane := nClrBack   endif   if cBmp1 != nil      if File( cBmp1 )         ::hBitmap1  = ReadBitmap( 0, cBmp1 )         ::hPalette1 = 0      else         ::hBitmap1  = LoadBitmap( GetResources(), cBmp1 )         ::hPalette1 = 0      endif      if ::hBitmap1 == 0         ::hBitmap1 := nil      else         DEFAULT nWidth := nBmpWidth( ::hBitmap1 ) + 7      endif   endif   if cBmp2 != nil      if File( cBmp2 )         ::hBitmap2  = ReadBitmap( 0, cBmp2 )         ::hPalette2 = 0      else         ::hBitmap2  = LoadBitmap( GetResources(), cBmp2 )         ::hPalette2 = 0      endif      if ::hBitmap2 == 0         ::hBitmap2 := nil      else         DEFAULT nWidth := nBmpWidth( ::hBitmap2 ) + 7      endif   endif   DEFAULT nWidth := 40   ::nWidth = nWidth   if ! Empty( ::cToolTip )      ::oMsgBar:cToolTip := ""   endif   if lAdd      oMsgBar:AddItem( Self )   endifreturn Self//----------------------------------------------------------------------------//#ifdef __CLIPPER__static function IsAppThemed()return .f.#endif//----------------------------------------------------------------------------//METHOD nLeft() CLASS TMsgItem   local n := Len( ::oMsgBar:aItem ), nPos := ::oMsgBar:nRight - ;              If( IsAppThemed(), 13, ;                  If( IsZoomed( ::oMsgBar:oWnd:hWnd ), 3, 13 ) )   while n > 0 .and. ! ::oMsgBar:aItem[ n ] == Self      nPos -= ( ::oMsgBar:aItem[ n ]:nWidth + 4 )      n--   end   nPos -= ( ::nWidth - 2 )return nPos//----------------------------------------------------------------------------//METHOD IsOver( nRow, nCol ) CLASS TMsgItem   local nLeft := ::nLeft()return nCol >= ( nLeft - 1 ) .and. ( nCol <= nLeft + ( ::nWidth - 7 ) ) .and. ;       nRow > 5//----------------------------------------------------------------------------//METHOD Paint() CLASS TMsgItem   local nCount, nClrBack    local nLeft := ::nLeft()    local hBmp, nBmpWidth := 0    local hDC    hDC := ::oMsgBar:GetDC()    if ::omsgbar:l2007       Gradient( hDC, { 0, nLeft, ::omsgbar:nHeight / 3, nLeft + ::nWidth },;                 nRGB( 227, 239, 255 ), nRGB( 201, 224, 255 ), .T. )       Gradient( hDC, { ( ::omsgbar:nHeight / 3 ) + 1, nLeft, ::omsgbar:nHeight, nLeft + ::nWidth },;                 nRGB( 174, 209, 255 ), nRGB( 186, 216, 255 ), .T. )    endif    if ::hBitmap1 != nil       hBmp = If( ::lActive, ::hBitmap1, ;                  If( ::hBitmap2 != nil, ::hBitmap2, ::hBitmap1 ) )       nBmpWidth  = nBmpWidth( hBmp )       DrawMasked( hDC, hBmp, 4, nLeft + 1 )    endif    if ::omsgbar:l2007       ::oMsgBar:Say( ::oMsgBar:nHeight / 4 - 2,;              nLeft + (::nWidth - GetTextWidth( hDC,::cMsg ))/2, ::cMsg, ;              iif( ::lActive, ::nClrText, ::nClrDisabled ), ::nClrPane, ;              ::oFont, .T., .T. )       wndboxin( hDc, 0, nLeft-1, ::oMsgBar:nHeight, nLeft )   // present test values    else       DrawMsgItem( hDC, ::cMsg,;                 { 5, nLeft + nBmpWidth, ::oMsgBar:nHeight-6, nLeft + ( ::nWidth - 7 ) },;                 If( ::lActive, ::nClrText, ::nClrDisabled ),;                 ::nClrPane, ::oFont:hFont )       WndBoxIn( hDC, 3, nLeft - 2, ::oMsgBar:nHeight-5, nLeft + ::nWidth - 6 ) // fwh    endif    ::oMsgBar:ReleaseDC() return nil //----------------------------------------------------------------------------//METHOD Refresh() CLASS TMsgItem   local cMsg   if ::bMsg != nil      cMsg = cValToChar( Eval( ::bMsg ) )      if cMsg != ::cMsg .or. ::lActive != ::lWasActive         ::cMsg = cMsg         ::Paint()         ::lWasActive = ::lActive      endif   endifreturn nil//----------------------------------------------------------------------------//
Best Regards, Saludos

Falconi Silvio
Post Reply