Page 1 of 3

SET MESSAGE ERROR

Posted: Tue Dec 18, 2007 1:27 am
by Silvio
Dear Antonio,

Image


I have only modify on the method paint tmsgitem this line

Code: Select all

 
WndBoxIn( hDC, 0, nLeft - 8, ::oMsgBar:nHeight - 1, nLeft - 7 )

and on the application I insert this command

Code: Select all

 SET MESSAGE OF ::oWndMain TO  ::cAppName NOINSET  2007
the message are not trasparent

On the tmsgiten original NOT run ok the command NOINSET ...why ?

Posted: Tue Dec 18, 2007 9:38 am
by Antonio Linares
Silvio,

You may use SetBkMode( hDC, TRANSPARENT ) in function DRAWMSGITEM(), but the problem is that the background will not be erased, when you change the msgitem text.

We need to fix it, copying the portion of the msgbar image where the item is (using BitBlt()) to the item background. Its on our todo list

Posted: Tue Dec 18, 2007 11:02 am
by nageswaragunupudi
I am able to paint the msgitem text in transparent mode, but unable to repaint the background. I am not good in graphics. I failed both using bitmap and gradient.

Eagerly awaiting the improvement from FWH

Posted: Tue Dec 18, 2007 11:04 am
by Silvio
thanks
I thinked you'already corrected the problem on 7.12...
I'm trying to correct it but I have some problems

Posted: Tue Dec 18, 2007 11:34 am
by nageswaragunupudi
This seems to be working tolerably. Actually we need to use the bitmap. Instead I used gradient to approximate the colors of the bitmap used for the message bar.

Code: Select all

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

      Gradient( hDC, { 0, nLeft, ::omsgbar:nHeight / 4, nLeft + ::nWidth },;
                nRGB( 227, 239, 255 ), nRGB( 201, 224, 255 ), .T. )
      Gradient( hDC, { ( ::omsgbar:nHeight / 4 ) + 1, nLeft, ::omsgbar:nHeight, nLeft + ::nWidth },;
                nRGB( 174, 209, 255 ), nRGB( 186, 216, 255 ), .T. )



      ::oMsgBar:Say( ::oMsgBar:nHeight / 4 - 2,;
             nLeft + (::nWidth / 2)  - GetTextWidth( hDC,::cMsg ), ::cMsg, ;
             iif( ::lActive, ::nClrText, ::nClrDisabled ), ::nClrPane, ; // ::nClrPane is anyway ignored
             ::oFont, .T., .T. )



// WndBoxIn( hDC, 3, nLeft - 2, ::oMsgBar:nHeight-5, nLeft + ::nWidth - 6 ) // fwh
//	WndBoxIn( hDC, 0, nLeft - 8, ::oMsgBar:nHeight - 1, nLeft - 7 )  // silvio
   wndboxin( hDc, 0, nLeft-1, ::oMsgBar:nHeight, nLeft )   // present test values
// Instead of the above function I prefer to draw two vertical lines with highlight and dark pens

   ::oMsgBar:ReleaseDC()


return nil
This is the result
Image

Posted: Tue Dec 18, 2007 11:47 am
by nageswaragunupudi
Changed the gradient function slightly. This gives relatively a better look. Till we can paint background with bitmap instead of gradient.

Code: Select all

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

Looks:
Image

Posted: Tue Dec 18, 2007 11:51 am
by Silvio
Dear friend,
I see many errors
try with

SET MESSAGE OF oWnd TO FWCOPYRIGHT 2007 NOINSET DATE CLOCK
DEFINE MSGITEM OF oWnd:oMsgBar SIZE 100 prompt " Test TEST"

Posted: Tue Dec 18, 2007 11:58 am
by nageswaragunupudi
here it is

Image

Anyway you are welcome to improve it. This is a quick work from me.

Posted: Tue Dec 18, 2007 12:12 pm
by Silvio
Look my picture
Image

Posted: Tue Dec 18, 2007 12:16 pm
by nageswaragunupudi
Ok Sorry
Please replace this line instead of the previous code. There was a minor mistake in centering the message

Code: Select all

      ::oMsgBar:Say( ::oMsgBar:nHeight / 4 - 2,;
             nLeft + (::nWidth - GetTextWidth( hDC,::cMsg ))/2, ::cMsg, ;
             iif( ::lActive, ::nClrText, ::nClrDisabled ), ::nClrPane, ;
             ::oFont, .T., .T. )
use this code instead of the old one i posted

Posted: Tue Dec 18, 2007 12:44 pm
by nageswaragunupudi
Mr Silvio

Because I do not use bitmaps with msgitems I did not bother about bitmaps. Better thing would be to move the gradient code to the top and paint the bitmaps transparently. I know you use bitmaps.

Hope you dont mind sharing your final working code with bitmaps too.

Posted: Tue Dec 18, 2007 12:50 pm
by Silvio
Now it is as yours
thanks

Posted: Tue Dec 18, 2007 2:12 pm
by Silvio
DEFINE MSGITEM oMsgItem2;
OF oWnd:oMsgBar ;
PROMPT "Test with Bitmaps" ;
SIZE 100 ;
BITMAP "EUSUARIO", "EUSUARIO";
TOOLTIP " " + i18n("Acerca de...") + " ";
ACTION MsgInfo( "Test with Bitmaps" )


BUT THIS COMMAND NOT RUN
I CANNOT SEE THE BITMAP

Posted: Tue Dec 18, 2007 3:32 pm
by nageswaragunupudi
As I said earlier, I did not take care of bitmap painting. But suggested what could be done. Anyway I am posting the revised paint method to paint bitmaps also.

Code: Select all


METHOD Paint(lown) 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


Posted: Tue Dec 18, 2007 3:39 pm
by nageswaragunupudi
here is how it looks

Image