Bug in TBitmap [Fixed]

Bug in TBitmap [Fixed]

Postby Enrico Maria Giordano » Wed May 23, 2018 10:50 pm

Please try the following sample (with the manifest file). Click on the checkbox and you'll see that it doesn't change its status. It works fine if the bitmap exists.

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL lVar := .F.

    DEFINE DIALOG oDlg;
           RESOURCE "TEST"

    REDEFINE BITMAP;
             ID 101 OF oDlg;
             FILE "NONEXISTENT.BMP"

    REDEFINE CHECKBOX lVar;
             ID 102 OF oDlg

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


Code: Select all  Expand view  RUN
1 24 "c:\fwh\samples\winxp\WindowsXP.Manifest"

TEST DIALOG 0, 0, 300, 300
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "", 101, "TBitmap", WS_CHILD | WS_VISIBLE, 10, 10, 57, 62
 CONTROL "TCheckBox", 102, "BUTTON", BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 120, 30, 46, 13
}


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

Re: Bug in TBitmap

Postby Enrico Maria Giordano » Thu May 24, 2018 10:38 am

This is a fix that seems to work:

Code: Select all  Expand view  RUN
::LoadImage( cResName, If( cBmpFile != nil .and. File( cBmpFile ), AllTrim( cBmpFile ), nil ) )


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

Re: Bug in TBitmap

Postby nageswaragunupudi » Tue May 29, 2018 5:31 am

The problem is because the following lines in the Paint() method
Code: Select all  Expand view  RUN
  if Empty( ::hBitmap ) .and. ! Empty( ::cBmpFile )
      ::LoadBmp( ::cBmpFile )
   endif
 

keep calling LoadImage() repeatedly.

This is fixed by inserting these lines before present line no. 833 ( FWH18.03)
Code: Select all  Expand view  RUN
     if ::hBitmap == 0
         ::cResName  := ::cBmpFile := nil
      endif
 

in the method LoadImage().

Thank you for pointing out this bug.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 0 guests