Page 1 of 1

Bug in TBtnBmp prompt

Posted: Wed Nov 21, 2007 9:17 am
by Enrico Maria Giordano
In the following sample the prompt is not splitted across two lines and two little squares are displayed instead:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBar

    DEFINE WINDOW oWnd

    DEFINE BUTTONBAR oBar OF oWnd 2007;
           SIZE 50, 70

    DEFINE BUTTON OF oBar;
           ACTION oWnd:End();
           PROMPT "Close" + CRLF + "Window"

    ACTIVATE WINDOW oWnd

    RETURN NIL
EMG

Posted: Wed Nov 21, 2007 5:04 pm
by Antonio Linares
Enrico,

In Class TBtnBmp please replace:

Code: Select all

         ::Say( 2 * ( ::nHeight / 3 ) + If( ::lPressed, 1, 0 ),;
                ( ::nWidth / 2 ) - ( GetTextWidth( ::hDC, ::cCaption,;
                ::oWnd:oFont:hFont ) / 2 ) + If( ::lPressed, 1, 0 ),;
                ::cCaption, nClr,, ::oWnd:oFont, .T., .T. )
with

Code: Select all

         nTop = 2 * ( ::nHeight / 3 ) + If( ::lPressed, 1, 0 ) + If( At( CRLF, ::cCaption ) == 0, 5, 0 ) 
         SetBkMode( ::hDC, 1 )
         hOldFont = SelectObject( ::hDC, ::oWnd:oFont:hFont )         
         DrawText( ::hDC, ::cCaption,;
                   { nTop - 5, If( ::lPressed, 1, 0 ), nTop + ::nHeight / 3, ::nWidth + If( ::lPressed, 1, 0 ) },;
                   nOr( DT_VCENTER, DT_CENTER, DT_WORDBREAK ) )
         SelectObject( ::hDC, hOldFont )          
You need these defines:

Code: Select all

#define DT_CENTER           1
#define DT_VCENTER          4
#define DT_WORDBREAK       16
Image
Thanks!

Posted: Wed Nov 21, 2007 7:01 pm
by Enrico Maria Giordano
I can wait for the new FWH release, thank you. :-)

EMG

Posted: Wed Nov 21, 2007 7:02 pm
by Antonio Linares
Enrico,

It will be available by early December :-)

Posted: Wed Nov 21, 2007 10:30 pm
by Enrico Maria Giordano
Great! :-)

EMG

Posted: Wed Nov 21, 2007 11:33 pm
by Silvio
Antonio,
Have you modify msgitem ( clock and date ) on msgbar ?

Posted: Thu Nov 22, 2007 8:30 am
by Antonio Linares
Silvio,

No, not yet

Posted: Fri Nov 23, 2007 3:15 pm
by Maurilio Viana
Antonio, I don't found this code in my BtnBmp.prg... My version is FWH 7.1 and I have this problem, when I use CRLF to "break" the text in more than 1 line text is displayed in same line and CRLF turn into a square character.

Thanks!
Maurilio

Posted: Fri Nov 23, 2007 4:17 pm
by Antonio Linares
Maurilio,

Basically the function used to paint the text has to be (Window's) DrawText() instead of TextOut().

The published patch is for FWH 7.11. We have to build another for 7.01

Posted: Fri Nov 23, 2007 4:58 pm
by nageswaragunupudi
This modification is working for 2007 style only. For non 2007 style both lines of text are painted in the middle of the bitmap

Image

Posted: Sun Nov 25, 2007 1:36 pm
by nageswaragunupudi
Mr Antonio

Can a fix be made available for multi-line prompts for tbar without 2007 style please?