Page 1 of 2

Bug in the new 2007 clause

Posted: Tue Oct 09, 2007 9:59 am
by Enrico Maria Giordano
This is the sample. If you uncomment the 2007 clause the bitmap will be shifted up.

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBar

    DEFINE WINDOW oWnd

    DEFINE BUTTONBAR oBar OF oWnd //2007

    DEFINE BUTTON OF oBar;
           FILE "C:\FWH\BITMAPS\CLIENT.BMP"

    ACTIVATE WINDOW oWnd

    RETURN NIL
EMG

Posted: Tue Oct 09, 2007 6:13 pm
by Antonio Linares
Enrico,

Fixed:

TransBmp( ::hBitmap1, nBmpWidth( ::hBitmap1 ), nBmpHeight( ::hBitmap1 ), nZeroZeroClr, ::hDC,;
( ::nWidth / 2 ) - ( nBmpWidth( ::hBitmap1 ) / 2 ) + If( ::lPressed, 2, 1 ),;
Max( 0, ( ::nHeight / 3 ) - ( nBmpHeight( ::hBitmap1 ) / 2 ) + If( ::lPressed, 2, 1 ) ),;
nBmpWidth( ::hBitmap1 ), nBmpHeight( ::hBitmap1 ) )

many thanks for your feedback :-)

We plan to publish a modified 7.10 build this same week with late-changes on Class TBtnBmp

Posted: Tue Oct 09, 2007 11:09 pm
by Enrico Maria Giordano
Thank you!

EMG

Posted: Wed Oct 10, 2007 7:07 am
by Enrico Maria Giordano
A little change to your fix:

Code: Select all

         TransBmp( ::hBitmap1, nBmpWidth( ::hBitmap1 ), nBmpHeight( ::hBitmap1 ), nZeroZeroClr, ::hDC,;
                   ( ::nWidth / 2 ) - ( nBmpWidth( ::hBitmap1 ) / 2 ) + If( ::lPressed, 2, 1 ),;
                   Max( 0, ( ::nHeight / 3 ) - ( nBmpHeight( ::hBitmap1 ) / 2 ) ) + If( ::lPressed, 2, 1 ),; 
                   nBmpWidth( ::hBitmap1 ), nBmpHeight( ::hBitmap1 ) )
Without this the buttons are shifted on right instead of right-down when pressed.

EMG

Posted: Wed Oct 10, 2007 7:24 am
by Enrico Maria Giordano
Another problem: it seems that the height of the buttons is shorter with 2007 clause. Can you check?

EMG

Posted: Wed Oct 10, 2007 7:26 am
by Enrico Maria Giordano
One more bug. In the following sample try to move the mouse over the button and you will see that the font of the messagebar is changed.

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBar

    DEFINE WINDOW oWnd

    DEFINE BUTTONBAR oBar OF oWnd

    DEFINE BUTTON OF oBar;
           TOOLTIP "Test"

    SET MESSAGE OF oWnd TO "This is a test" 2007

    ACTIVATE WINDOW oWnd

    RETURN NIL
EMG

Posted: Wed Oct 10, 2007 8:36 am
by Antonio Linares
Enrico,

> Without this the buttons are shifted on right instead of right-down when pressed.

My mistake. Yes, you are right, as usual :-)

Posted: Wed Oct 10, 2007 8:57 am
by Antonio Linares
Enrico,

>
In the following sample try to move the mouse over the button and you will see that the font of the messagebar is changed.
>

Fixed. Many thanks for your feedback :-)

Please make this change in Class TMsgBar Method Paint():

Code: Select all

      ::Say( ::nHeight / 4,;
             If( ::lCentered, ( ::nWidth / 2 ) - ( GetTextWidth( ::hDC,;
             If( Empty( ::cMsg ), ::cMsgDef, ::cMsg ),;
             ::oWnd:oFont:hFont ) / 2 ), 10 ), If( Empty( ::cMsg ), ::cMsgDef, ::cMsg ),;
             ::nClrText,,, .T., .T. )

Posted: Wed Oct 10, 2007 9:03 am
by Enrico Maria Giordano
Thank you. Can you check this too?
EnricoMaria wrote:Another problem: it seems that the height of the buttons is shorter with 2007 clause.
EMG

Posted: Wed Oct 10, 2007 9:17 am
by Antonio Linares
Enrico,

It seems ok. Please check this example using and removing 2007:

Code: Select all

#include "Fivewin.ch" 


FUNCTION MAIN() 

    LOCAL oWnd, oBar 

    DEFINE WINDOW oWnd 

    DEFINE BUTTONBAR oBar OF oWnd SIZE 40, 40 // 2007

    DEFINE BUTTON OF oBar ; 
           TOOLTIP "Test" ACTION MsgInfo( oBar:aControls[ 1 ]:nHeight )

    SET MESSAGE OF oWnd TO "This is a test" 2007 

    ACTIVATE WINDOW oWnd 

    RETURN NIL

Posted: Wed Oct 10, 2007 9:24 am
by Enrico Maria Giordano
Ok, but try with 3D clause:

Code: Select all

DEFINE BUTTONBAR oBar OF oWnd SIZE 40, 40 2007 3D
EMG

Posted: Wed Oct 10, 2007 9:26 am
by Enrico Maria Giordano
With the following change we get the same position for message of 2007 and not 2007 style msgbar:

Code: Select all

      ::Say( ::nHeight / 4 - 2,;
             If( ::lCentered, ( ::nWidth / 2 ) - ( GetTextWidth( ::hDC,;
             If( Empty( ::cMsg ), ::cMsgDef, ::cMsg ),;
             ::oWnd:oFont:hFont ) / 2 ), 4 ), If( Empty( ::cMsg ), ::cMsgDef, ::cMsg ),;
             ::nClrText,,, .T., .T. )
EMG

Posted: Wed Oct 10, 2007 9:42 am
by Enrico Maria Giordano
The bitmaps are no longer centered inside the buttons with 2007 clause:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBar

    DEFINE WINDOW oWnd

    DEFINE BUTTONBAR oBar OF oWnd SIZE 40, 40 2007

    DEFINE BUTTON OF oBar;
           FILE "C:\FWH\BITMAPS\CLIENT.BMP"

    ACTIVATE WINDOW oWnd

    RETURN NIL
EMG

Posted: Wed Oct 10, 2007 9:52 am
by Antonio Linares
Enrico,

> Ok, but try with 3D clause:

Yes, you are right, 3D clause should not be used with 2007 clause together, or buttons will not cover all the bar height

Posted: Wed Oct 10, 2007 9:54 am
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,

> Ok, but try with 3D clause:

Yes, you are right, 3D clause should not be used with 2007 clause together, or buttons will not cover all the bar height
Right.

EMG