FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A Strange Error in TGroup in 12.02
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
A Strange Error in TGroup in 12.02
Posted: Thu Mar 08, 2012 04:02 PM
Hi,

As you can see difference in screenshots as below, I think there is a paint problem in TGroup class.

The code is exactly the same.

1) Look to the group title.
2) disappears some lines in group.


12.01 screenshoot


12.02 screenshoot


Thanks
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.02
Posted: Fri Mar 09, 2012 08:51 AM

Antonio

Any comment?

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: A Strange Error in TGroup in 12.02
Posted: Sat Mar 10, 2012 05:24 PM
Hakan,

Please add this function inside FWH\source\classes\group.prg:
Code (fw): Select all Collapse
static function IsAppThemed()

return .F.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.02
Posted: Sun Mar 11, 2012 09:29 AM

Antonio,

It works OK now.

I just want to know that Should I change everytime group.prg in every new version or you changed it in your group.prg?

Thanks

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: A Strange Error in TGroup in 12.02
Posted: Sun Mar 11, 2012 04:15 PM

Hakan,

Please provide me a small PRG to reproduce the GROUP paint error here and we will fix it for FWH 12.03, thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.02
Posted: Sun Mar 11, 2012 07:00 PM
Antonio,

I have tried to simulate the my application. but I only simulate the group title error. I think it occurs when the group is resized.

Code (fw): Select all Collapse
#include "FiveWin.ch" 

function Main() 
  
  DEFINE FONT oFnt NAME "Verdana" SIZE 0, -16 BOLD 
    DEFINE FONT oFnt1 NAME "Verdana" SIZE 0, -12

   DEFINE DIALOG oDlg SIZE 620, 294 FONT oFnt1 TRANSPARENT ;
        STYLE nOr( WS_OVERLAPPEDWINDOW ) //COLOR CLR_BLACK,RGB(196,244,244)
        oDlg:SetColor(,9425383)
   
  @ 2, 3 GROUP oGrp TO 150, 150 PROMPT " Group Text " OF oDlg PIXEL TRANSPARENT;
    FONT oFnt

  @ 65, 3 GROUP oGrp1 TO 150, 150 PROMPT " Second Group Text " OF oDlg PIXEL TRANSPARENT;
    FONT oFnt
  
  @ 80, 10 SAY "XXXXXXXXXXXXXXXXXXXXXXXXXX" OF oDlg PIXEL FONT oFnt1 TRANSPARENT
  
    @ 100,10 BUTTON obtnCancel PROMPT "&Cancel" OF oDlg PIXEL SIZE 50,13 ;
        ACTION oDlg:End()
        
  oDlg:bResized := {|| RESIZE_IT(oGrp, obtnCancel, oGrp1) }
    ACTIVATE DIALOG oDlg CENTERED ON INIT RESIZE_IT(oGrp, obtnCancel, oGrp1)
    
    oFnt:End()
    oFnt1:End()

return nil 

PROCEDURE RESIZE_IT(oGrp, obtnCancel, oGrp1)
  oGrp:nHeight := oDlg:nHeight-80-oGrp:nTop
  oGrp:nWidth  := oDlg:nWidth-29 
  
  oGrp1:nHeight := oDlg:nHeight-80-oGrp1:nTop
  oGrp1:nWidth  := oDlg:nWidth-29 

  obtnCancel:nTop := oDlg:nHeight-70
  obtnCancel:nLeft := oDlg:nWidth-120 
return
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.02
Posted: Wed Mar 21, 2012 07:55 AM

up

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: A Strange Error in TGroup in 12.02
Posted: Wed Mar 21, 2012 10:49 AM
Hakan,

Your example looks fine here, whats wrong with it ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.02
Posted: Wed Mar 21, 2012 11:31 AM
Hi,

Look at the group title.

.rc
Code (fw): Select all Collapse
   1 24 "WindowsXP.Manifest"


Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.02
Posted: Thu Mar 29, 2012 08:05 AM

up

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: A Strange Error in TGroup in 12.02
Posted: Thu Mar 29, 2012 08:30 AM
Try changing this (look at EMG) in group.prg:

Code (fw): Select all Collapse
METHOD Paint() CLASS TGroup

   local aSize, hOldFont

   CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )

   if .F. //IsAppThemed() //EMG
      aSize = GetLabelDim( ::hWnd, ::cCaption, ::oWnd:oFont:hFont )
      hOldFont = SelectObject( ::hDC, ::oWnd:oFont:hFont )
      SetBrushOrgEx( ::hDC, nBmpWidth( ::oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oBrush:hBitmap ) - ::nTop )
      FillRect( ::hDC, { 0, 7, aSize[ 2 ] + 2, aSize[ 1 ] + 11 }, ::oBrush:hBrush )
      SetBkMode( ::hDC, 1 )
      TextOut( ::hDC, 0, 9, ::cCaption, Len( ::cCaption ) )
      SelectObject( ::hDC, hOldFont )
   endif   

return 1


EMG
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.02
Posted: Fri Mar 30, 2012 07:34 AM

Thanks Enrico,

If I use 12.01, There is not problem.

I will wait a solution in 12.03.

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: A Strange Error in TGroup in 12.02
Posted: Fri Mar 30, 2012 10:19 AM
Hakan,

This change is required in Class TGroup: (fwh\source\classes\group.prg)

Code (fw): Select all Collapse
METHOD Paint() CLASS TGroup

   local aSize, hOldFont, oFont

   CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )

   if IsAppThemed()
      oFont = If( ::oFont != nil, ::oFont, ::oWnd:oFont )
      ASize = GetLabelDim( ::hWnd, ::cCaption, oFont:hFont )
      hOldFont = SelectObject( ::hDC, oFont:hFont )
      SetBrushOrgEx( ::hDC, nBmpWidth( ::oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oBrush:hBitmap ) - ::nTop )
      FillRect( ::hDC, { 0, 7, aSize[ 2 ] + 2, aSize[ 1 ] + 11 }, ::oBrush:hBrush )
      SetBkMode( ::hDC, 1 )
      TextOut( ::hDC, 0, 9, ::cCaption, Len( ::cCaption ) )
      SelectObject( ::hDC, hOldFont )
   endif   

return 1
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: A Strange Error in TGroup in 12.03
Posted: Mon Apr 02, 2012 08:27 AM
Hi Antonio,

I have copied the your emailed Fivehcm.lib to lib directory. I have have deleted the group.prg from my xbp file and compiled.

Result :

- The font problem is gone. It is OK now.
- disapearing group line is same as fwh 12.02. (I know I could not prepare a small sample for it.)

I have added to group.prg to my xbp file and I have remarked the below line:

Code (fw): Select all Collapse
      //FillRect( ::hDC, { 0, 7, aSize[ 2 ] + 2, aSize[ 1 ] + 11 }, ::hBrush )


It is ok now. Is this line is necessary?

Thanks.
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: A Strange Error in TGroup in 12.02
Posted: Mon Apr 02, 2012 08:36 AM

Hakan,

In our first tests it was needed, but now, yes you are right we could remove it, as the SetBrushOrgEx() is properly filling the background where we paint the text :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion