Bug in the new 2007 clause

User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Bug in the new 2007 clause

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

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
Last edited by Enrico Maria Giordano on Wed Oct 10, 2007 9:04 am, edited 1 time in total.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Another problem: it seems that the height of the buttons is shorter with 2007 clause. Can you check?

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

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

Post 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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. )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

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

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Ok, but try with 3D clause:

Code: Select all

DEFINE BUTTONBAR oBar OF oWnd SIZE 40, 40 2007 3D
EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

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

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

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
Post Reply