Page 1 of 1

Bug in message bar

Posted: Tue Feb 12, 2008 10:13 pm
by Enrico Maria Giordano
In the following sample, the text "CHECKLIST" is not centered and the item background is not red:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd

    DEFINE WINDOW oWnd

    SET MESSAGE OF oWnd 2007

    DEFINE MSGITEM OF oWnd:oMsgBar;
           SIZE 70;
           COLOR CLR_BLACK, CLR_HRED;
           PROMPT "CHECKLIST"

    oWnd:oMsgBar:KeybOn()
    oWnd:oMsgBar:DateOn()
    oWnd:oMsgBar:ClockOn()

    ACTIVATE WINDOW oWnd

    RETURN NIL
EMG

Posted: Tue Feb 12, 2008 10:22 pm
by Antonio Linares
Enrico,

The item background color is not used if 2007 is specified (at least, not yet)

Regarding the center of the text, we are using GetTextWidth() to calculate its position when painting it. But it seems that GetTextWidth() does not work fine or we are doing something wrong...

Posted: Tue Feb 12, 2008 10:26 pm
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,

The item background color is not used if 2007 is specified (at least, not yet)
Ok.
Antonio Linares wrote:Regarding the center of the text, we are using GetTextWidth() to calculate its position when painting it. But it seems that GetTextWidth() does not work fine or we are doing something wrong...
Ok, thank you.

EMG

Posted: Wed Feb 13, 2008 11:06 am
by Enrico Maria Giordano
This is a possible fix:

Code: Select all

   if ::oMsgBar:l2007
      ::oMsgBar:Say( ::oMsgBar:nHeight / 4 - 2,;
             nLeft - 1 + ( ::nWidth - GetTextWidth( hDC, AllTrim( ::cMsg ), ::oFont:hFont ) ) / 2,;
             AllTrim( ::cMsg ), If( ::lActive, ::nClrText, ::nClrDisabled ),;
             ::nClrPane, ::oFont, .T., .T. )
      WndBoxIn( hDC, 2, nLeft - 4, ::oMsgBar:nHeight - 2, nLeft - 3 )
   else
EMG

Posted: Thu May 22, 2008 10:41 pm
by Cgallegoa
Possible fix with BitMap:

if ::oMsgBar:l2007
::oMsgBar:Say( ::oMsgBar:nHeight / 4 - 2,;
nLeft + nBmpWidth - iif(nBmpWidth>0,7,1) + ( ::nWidth - GetTextWidth( hDC, AllTrim( ::cMsg ), ::oFont:hFont ) ) / 2,;
AllTrim( ::cMsg ), If( ::lActive, ::nClrText, ::nClrDisabled ),;
::nClrPane, ::oFont, .T., .T. )

// nLeft - 1 + ( ::nWidth - GetTextWidth( hDC, AllTrim( ::cMsg ), ::oFont:hFont ) ) / 2,;

WndBoxIn( hDC, 2, nLeft - 4, ::oMsgBar:nHeight - 2, nLeft - 3 )

else


Regards,

Carlos Gallego