FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos Bug in TBitmap [Fixed]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TBitmap [Fixed]
Posted: 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 (fw): Select all Collapse
#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 (fw): Select all Collapse
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TBitmap
Posted: Thu May 24, 2018 10:38 AM
This is a fix that seems to work:

Code (fw): Select all Collapse
::LoadImage( cResName, If( cBmpFile != nil .and. File( cBmpFile ), AllTrim( cBmpFile ), nil ) )


EMG
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Bug in TBitmap
Posted: Tue May 29, 2018 05:31 AM
The problem is because the following lines in the Paint() method
Code (fw): Select all Collapse
   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 (fw): Select all Collapse
      if ::hBitmap == 0
         ::cResName  := ::cBmpFile := nil
      endif

in the method LoadImage().

Thank you for pointing out this bug.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion