Bug in message bar

Bug in message bar

Postby Enrico Maria Giordano » Tue Feb 12, 2008 10:13 pm

In the following sample, the text "CHECKLIST" is not centered and the item background is not red:

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Enrico Maria Giordano » Wed Feb 13, 2008 11:06 am

This is a possible fix:

Code: Select all  Expand view
   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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Cgallegoa » 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
Cgallegoa
 
Posts: 492
Joined: Sun Oct 16, 2005 3:32 am
Location: Quito - Ecuador


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 80 guests