FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in message bar
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in message bar
Posted: Tue Feb 12, 2008 10:13 PM
In the following sample, the text "CHECKLIST" is not centered and the item background is not red:

#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in message bar
Posted: Tue Feb 12, 2008 10:22 PM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in message bar
Posted: Tue Feb 12, 2008 10:26 PM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in message bar
Posted: Wed Feb 13, 2008 11:06 AM
This is a possible fix:

   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
Posts: 514
Joined: Sun Oct 16, 2005 03:32 AM
Bug in message bar
Posted: Thu May 22, 2008 10:41 PM

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

Saludos,



Carlos Gallego



*** FWH-25.12, xHarbour 1.3.1 Build 20241008, Borland C++7.70, PellesC, ADS 11.1***

Continue the discussion