FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SET MESSAGE ERROR
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 01:27 AM
Dear Antonio,




I have only modify on the method paint tmsgitem this line

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



and on the application I insert this command
 SET MESSAGE OF ::oWndMain TO  ::cAppName NOINSET  2007


the message are not trasparent

On the tmsgiten original NOT run ok the command NOINSET ...why ?
Best Regards, Saludos



Falconi Silvio
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 09:38 AM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 11:02 AM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 11:04 AM

thanks
I thinked you'already corrected the problem on 7.12...
I'm trying to correct it but I have some problems

Best Regards, Saludos



Falconi Silvio
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 11:34 AM
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.
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
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 11:47 AM
Changed the gradient function slightly. This gives relatively a better look. Till we can paint background with bitmap instead of gradient.

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



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 11:51 AM

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"

Best Regards, Saludos



Falconi Silvio
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 11:58 AM
here it is



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



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 12:12 PM
Look my picture
Best Regards, Saludos



Falconi Silvio
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 12:16 PM
Ok Sorry
Please replace this line instead of the previous code. There was a minor mistake in centering the message
      ::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
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 12:44 PM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 12:50 PM

Now it is as yours
thanks

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 02:12 PM

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

Best Regards, Saludos



Falconi Silvio
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 03:32 PM
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.
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
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
SET MESSAGE ERROR
Posted: Tue Dec 18, 2007 03:39 PM
here is how it looks

Regards



G. N. Rao.

Hyderabad, India