Page 1 of 2

Program hang after 1505, *TSButton-Disable (nil)* *Fixed*

PostPosted: Mon Jul 20, 2015 6:17 am
by dutch
I rebuild my program with FWH1505/xHB1411 and it hang (not responding) as picture. I change to rebuild it with FWH1312/xHB1310, it is working well.
I guess, it depend on the control in the screen. It works fine with a few control but this screen has a lot of control.

How can I check the problem?

This is normal screen.
Image

This screen is not responding
Image

Thank you in advance,

Re: Program hang after upgrade to 1505, How to check?

PostPosted: Mon Jul 20, 2015 1:30 pm
by Antonio Linares
Dutch,

Could you please test it with FWH 15.06 ? thanks

Re: Program hang after upgrade to 1505, How to check?

PostPosted: Tue Jul 21, 2015 2:54 am
by dutch
Dear Antonio,

Where is BCC7?
dutchez4 @ gmail.com
Antonio Linares wrote:Dutch,

Could you please test it with FWH 15.06 ? thanks

Re: Program hang after upgrade to 1505, How to check?

PostPosted: Tue Jul 21, 2015 6:30 am
by Antonio Linares
Embarcadero

Re: Program hang after upgrade to 1505, How to check?

PostPosted: Tue Jul 21, 2015 7:49 am
by AntoninoP
just curiosity, can you try to remove some controls from dialog?
Looks like the problem is the disabled button: in the second screen is half painted...

Re: Program hang after upgrade to 1505, How to check?

PostPosted: Tue Jul 21, 2015 9:18 am
by dutch
OK, I will try. The new version doesn't help. It's still the same.

Thanks, I will try.

Re: Program hang after upgrade to 1505, How to check?

PostPosted: Tue Jul 21, 2015 9:58 am
by dutch
Dear AntinioP,

I found the problem now. The (Disable) TSButton is effected with the new version (1505). I try to remark the WHEN Clause, it works fine.

How can I fix it?
AntoninoP wrote:just curiosity, can you try to remove some controls from dialog?
Looks like the problem is the disabled button: in the second screen is half painted...

Re: Program hang after 1505, *TSButton (Disable) Problem*

PostPosted: Tue Jul 21, 2015 1:42 pm
by AntoninoP
I just tried TSButton from:
https://bitbucket.org/fivetech/fivewin-contributions/downloads/tsbutton.zip
applying:
https://fivewin-contributions.googlecode.com/files/bpaint.zip

I think the problem is GETFONTHEIGHT, that is defined in fivewin with a parameter as HFont and defined in bpaint.c with 2 parameters: an HDC and an HFont.
Locally I renamed the bpaint version as GETFONTHEIGHT2 and replaced all calls.

Done this, and recompiled it with FiveWin 15.03, MSVS and Harbour, the sample file works, even it writes in TESTBTN.log
Code: Select all  Expand view
07/21/15 15:32:02: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : 0 )
     <-TFONT:END(246) <-TCONTROL:DESTROY(2197) <-TSBUTTON:DESTROY(964) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSBUTTON:HANDLEEVENT(1317) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578)
    ------------------------------------------------------------   
07/21/15 15:32:02: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : -1 )
     <-TFONT:END(246) <-TCONTROL:DESTROY(2197) <-TSBUTTON:DESTROY(964) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSBUTTON:HANDLEEVENT(1317) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578)
    ------------------------------------------------------------   
07/21/15 15:32:02: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : 0 )
     <-TFONT:END(246) <-TSAY:DESTROY(2197) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSAY:HANDLEEVENT(227) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578) <-TMDICLIENT:SENDMSG(0)
    ------------------------------------------------------------   
07/21/15 15:32:02: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : -1 )
     <-TFONT:END(246) <-TSAY:DESTROY(2197) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSAY:HANDLEEVENT(227) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578) <-TMDICLIENT:SENDMSG(0)
    ------------------------------------------------------------   
07/21/15 15:32:02: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : -2 )
     <-TFONT:END(246) <-TSAY:DESTROY(2197) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSAY:HANDLEEVENT(227) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578) <-TMDICLIENT:SENDMSG(0)
    ------------------------------------------------------------   
07/21/15 15:32:21: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : 0 )
     <-TFONT:END(246) <-TCONTROL:DESTROY(2197) <-TSBUTTON:DESTROY(964) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSBUTTON:HANDLEEVENT(1317) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578)
    ------------------------------------------------------------   
07/21/15 15:32:21: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : -1 )
     <-TFONT:END(246) <-TCONTROL:DESTROY(2197) <-TSBUTTON:DESTROY(964) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSBUTTON:HANDLEEVENT(1317) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578)
    ------------------------------------------------------------   
07/21/15 15:32:21: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : 0 )
     <-TFONT:END(246) <-TSAY:DESTROY(2197) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSAY:HANDLEEVENT(227) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578) <-TMDICLIENT:SENDMSG(0)
    ------------------------------------------------------------   
07/21/15 15:32:21: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : -1 )
     <-TFONT:END(246) <-TSAY:DESTROY(2197) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSAY:HANDLEEVENT(227) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578) <-TMDICLIENT:SENDMSG(0)
    ------------------------------------------------------------   
07/21/15 15:32:21: EXCESS RELEASE OF FONT MS Sans Serif[ hFont : 0] ( nCount : -2 )
     <-TFONT:END(246) <-TSAY:DESTROY(2197) <-TWINDOW:HANDLEEVENT(0) <-TCONTROL:HANDLEEVENT(1746) <-TSAY:HANDLEEVENT(227) <-_FWH(3363) <-SENDMESSAGE(0) <-(b)TWINDOW(578) <-TMDICLIENT:SENDMSG(0)
    ------------------------------------------------------------   


Anyway, I think your problem is the GETFONTHEIGHT

PS: Are you sure you can not convert them in TBtnBmp?

Re: Program hang after 1505, *TSButton (Disable) Problem*

PostPosted: Tue Jul 21, 2015 4:28 pm
by carlos vargas
yo me recuerdo haber hecho algunas correcciones de este tipo en bpaint, si bien no uso la clase.
puedev revisar el codigo y realizar los cambios donde fuere necesario.
http://castillolawyers.no-ip.info/owncloud/index.php/s/PQL0ucrBbBHe7hH

Re: Program hang after 1505,*TSButton (Disable) w/Image Problem*

PostPosted: Wed Jul 22, 2015 2:54 am
by dutch
Dear AnotonioP and Carlos,

AntonioP : I try to change GETFONTHEIGHT -> GETFONTHEIGHT2 in all place. -> Rebuild SButtonx.lib -> unsuccessful and still hang when SBUTTON is disable
Carlos : I try to use all your files. -> Rebuild SButtonx.lib -> unsuccessful and still hang when SBUTTON is disable

I think disable stage is the problem and I try without RESOURCE (image), it has not problem.
Finally, the problem is DISABLE with (nil 3rd parameter of RESOURCE)!!!.
The 3rd array of Resource is nil, the Sbutton will be Dark Gray Color.
Code: Select all  Expand view
RESOURCE 'NEW1', 'NEW1', nil, 'NEW4' ;  => Hang
RESOURCE 'NEW1', 'NEW1', 'NEW3', 'NEW4' ; => No problem

I use many TSButton in my program. It is big job if change to TBtnBmp or TRbBtn.

Re: Program hang after 1505, *TSButton-Disable (nil) Problem*

PostPosted: Wed Jul 22, 2015 6:42 am
by Otto
Hello Dutch,

I did this job some times ago.
I changed AUTOCODE so I could select TSButton and had a switch that this was automatically changed to BTNBMP button.
Search the forum. We published the source code of AUTOCODE in the forum.
Best regards,
Otto


Image

Re: Program hang after 1505, *TSButton-Disable (nil)* *Fixed*

PostPosted: Wed Jul 22, 2015 11:08 am
by dutch
Dear Otto,

Thank you for your kind help. I found the problem now. It is the C Function in new FWH version.

Dear Antonio,

Could you change this function to Backward Compatible by default width, height := 0
Code: Select all  Expand view
void DrawGray( HDC hdc, HBITMAP hbm, int y, int x, int width, int height )
{
   HDC      hdcBmp = CreateCompatibleDC( hdc );
   HBITMAP  hbmOld;
   BITMAP   bm;
   COLORREF TransColor, col;
   int      i, j, sum;

   GetObject( hbm, sizeof( BITMAP ), ( LPSTR ) &bm );

   hbmOld = ( HBITMAP ) SelectObject( hdcBmp, hbm );
   TransColor = GetPixel( hdcBmp, 0, 0 );

   if ( width == 0 ) width = bm.bmWidth;
   if ( height == 0 ) height = bm.bmHeight;

   for( i = 0; i < width; i++ )
      for( j = 0; j < height; j++ )
      {
         col = GetPixel( hdcBmp, i , j );
         if( col != TransColor )
         {
            sum = GetRValue( col ) / 3 + GetGValue( col ) / 3 + GetBValue( col ) / 3;
            if( sum )
            {
               if( sum < ( 255 - 20 ) )
                  sum += 20;
               else
                  sum = 255;
            }
            SetPixel( hdc, i + x, j + y, RGB( sum, sum, sum ) );
         }
      }

   SelectObject( hdcBmp, hbmOld );
   DeleteDC( hdcBmp );
}

 

TSButton use this function in BPAINT.C and missing 2 new parameter.
Code: Select all  Expand view
void DrawGray( HDC hDC, HBITMAP hBmp, signed int iRow, signed int iCol ) ;


I fixed by add 2 new parameter in BPAINT.C
Code: Select all  Expand view
void DrawGray( HDC hDC, HBITMAP hBmp, signed int iRow, signed int iCol, signed int width, signed int height ) ;
..
DrawGray( hDC, hBitMap1, nTop, nLeft ,0 ,0 ) ;


Thank you for everyone.

Re: Program hang after 1505, *TSButton-Disable (nil)* *Fixed*

PostPosted: Thu Jul 23, 2015 7:44 am
by Antonio Linares
Dutch,

Your posted function DrawGray() is exactly like the one in FWH sources.

What to change ? :-)

Re: Program hang after 1505, *TSButton-Disable (nil)* *Fixed*

PostPosted: Thu Jul 23, 2015 10:44 am
by dutch
Dear Antonio,

Could you set default for width and height in FW source as 0, if do not put these 2 parameter? Because the TSButton use this function from FW but has no 2 new parameter (width/height), if possible.

Thanks.
Antonio Linares wrote:Dutch,

Your posted function DrawGray() is exactly like the one in FWH sources.

What to change ? :-)

Re: Program hang after 1505, *TSButton-Disable (nil)* *Fixed*

PostPosted: Mon Jun 10, 2019 9:13 am
by Uwe.Diemer
Hello Dutch

i changed it and get

--------------------Konfiguration: Optowin - Release--------------------
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
C:\Dev\Optowin\Tsbutton\SOURCE\FUNCTION\BPAINT.C:
Error E2227 C:\Dev\Optowin\Tsbutton\SOURCE\FUNCTION\BPAINT.C 494: Extra parameter in call to DrawGray in function HB_FUN_SBTNPAINT
*** 1 errors in Compile ***
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Optowin.EXE - 1 Fehler, 0 Warnung(en)

Tx