SET MESSAGE ERROR

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

SET MESSAGE ERROR

Post 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 ?
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

G. N. Rao.
Hyderabad, India
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

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

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

G. N. Rao.
Hyderabad, India
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post 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"
Best Regards, Saludos

Falconi Silvio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

here it is

Image

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

G. N. Rao.
Hyderabad, India
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Look my picture
Image
Best Regards, Saludos

Falconi Silvio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

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

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Now it is as yours
thanks
Best Regards, Saludos

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

Post 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
Best Regards, Saludos

Falconi Silvio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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

Regards

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

Post by nageswaragunupudi »

here is how it looks

Image
Regards

G. N. Rao.
Hyderabad, India
Post Reply