Bug in Transparent Group

Bug in Transparent Group

Postby nageswaragunupudi » Fri Dec 25, 2009 6:38 am

This is the sample showing the problem
Code: Select all  Expand view
#include 'fivewin.ch'

function Main()

   local oWnd

   DEFINE WINDOW oWnd COLOR CLR_WHITE,CLR_BLUE
   @ 20, 20 TO 200,400 PIXEL OF oWnd TRANSPARENT
   ACTIVATE WINDOW oWnd

return nil
 


This is the result:
Image

Background of the DestkTop is visible through the Group.
Is this a bug or am I doing something wrong?
Regards

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

Re: Bug in Transparent Group

Postby Antonio Linares » Sat Dec 26, 2009 9:30 pm

Rao,

Class TGroup uses a NULL brush for TRANSPARENT mode and the NULL brush does not work fine under all circunstances.

Please use this workaround which works better:
Code: Select all  Expand view

#include 'fivewin.ch'

function Main()

   local oWnd, oGrp

   DEFINE WINDOW oWnd COLOR CLR_WHITE, CLR_BLUE
   
   @ 20, 20 GROUP oGrp TO 200,400 PIXEL OF oWnd // TRANSPARENT
   
   oGrp:SetBrush( oWnd:oBrush )
   
   ACTIVATE WINDOW oWnd

return nil
 
regards, saludos

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

Re: Bug in Transparent Group

Postby nageswaragunupudi » Sun Dec 27, 2009 5:00 am

Mr. Antonio

Thanks.

But when we use image or gradient brush for the window, the background inside the group does not match the background of the window.

The following solution appears to be working ( for windows ), both when resized and brush is changed at runtime.
Code: Select all  Expand view
  oGrp:bEraseBkGnd := { |hDC| SetBrushOrgEx( hDC, -oGrp:nLeft, -oGrp:nTop ), ;
        FillRect( hDC, GetClientRect( oGrp:hWnd ), oGrp:oWnd:oBrush:hBrush ) }
 


Can TGroup include similar code?
Regards

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

Re: Bug in Transparent Group

Postby Antonio Linares » Sun Dec 27, 2009 9:15 am

Rao,

Included in FWH 9.12 this way:
Code: Select all  Expand view

METHOD EraseBkGnd( hDC ) CLASS TGroup

   if ! Empty( ::bEraseBkGnd )
      return Eval( ::bEraseBkGnd, hDC )
   endif

  if ::lTransparent
     if ! Empty( ::oWnd:oBrush:hBitmap )
        SetBrushOrgEx( hDC, nBmpWidth( ::oWnd:oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oWnd:oBrush:hBitmap ) - ::nTop )
     endif  
     FillRect( hDC, GetClientRect( ::hWnd ), ::oWnd:oBrush:hBrush )
  else
     FillRect( hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
  endif
 
return 0  
 

Thanks! :-)
regards, saludos

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

Re: Bug in Transparent Group

Postby Horizon » Sun Dec 27, 2009 6:40 pm

Antonio,

Can you try this sample using DIALOG with new EraseBkGnd and without.

Thanks,



Code: Select all  Expand view
#include 'fivewin.ch'

function Main()

   local oWnd, cGet := SPACE(15)

   DEFINE DIALOG oWnd COLOR CLR_WHITE,CLR_BLUE SIZE 600,400
   
   @ 20, 20 TO 100,200 PIXEL OF oWnd TRANSPARENT
     
   @ 60, 20 TO 100,200 PIXEL OF oWnd TRANSPARENT
     
   ACTIVATE DIALOG oWnd CENTER

return nil
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Bug in Transparent Group

Postby Horizon » Sun Dec 27, 2009 8:26 pm

Hi,

If I change the method like below it works in dialogs like windows. I don't know it is exactly true.

Code: Select all  Expand view
METHOD EraseBkGnd( hDC ) CLASS TGroup

   if ! Empty( ::bEraseBkGnd )
      return Eval( ::bEraseBkGnd, hDC )
   endif

  if ::lTransparent
     if ! Empty( ::oWnd:oBrush:hBitmap )
        SetBrushOrgEx( hDC, nBmpWidth( ::oWnd:oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oWnd:oBrush:hBitmap ) - ::nTop )
     endif  
     if UPPER(::oWnd:ClassName())="TWINDOW"     //added
            FillRect( hDC, GetClientRect( ::hWnd ), ::oWnd:oBrush:hBrush )
     endif //added
  else
     FillRect( hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
  endif
 
return 0
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Bug in Transparent Group

Postby Antonio Linares » Sun Dec 27, 2009 9:05 pm

Hakan,

Your example works fine here on Windows 7 with the new EraseBkGnd() code:

Image
regards, saludos

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

Re: Bug in Transparent Group

Postby Horizon » Sun Dec 27, 2009 9:47 pm

Antonio,

You mean it works without any modification. I also use W7. When my example run it show like below.

Image

When my sample lost focus, it is ok.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Bug in Transparent Group

Postby nageswaragunupudi » Mon Dec 28, 2009 3:37 am

On dialogs the previous code also works.

As I said earlier, the modification was necessary only for groups on windows.
Regards

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

Re: Bug in Transparent Group

Postby Horizon » Mon Dec 28, 2009 7:42 am

Hi,

I have no problem with fwh 9.11's TGroup class in dialogs or my modified 9.12 TGroup Class.

Thanks,
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Bug in Transparent Group

Postby Horizon » Tue Dec 29, 2009 10:49 am

Antonio ?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Bug in Transparent Group

Postby Antonio Linares » Tue Dec 29, 2009 4:07 pm

Hakan,

With FWH 9.12 and the posted example, here it works fine on Windows 7.

Please post an example if you have a wrong behavior, thanks
regards, saludos

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

Re: Bug in Transparent Group

Postby Horizon » Thu Dec 31, 2009 11:25 am

Hi Antonio,

Unfortunately, my previous example has the same error in my computer. I have the latest fwh 9.12 (I think).

I don't want to change TGroup class everytime that I downloaded fwh. How Can I solve my problem.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Bug in Transparent Group

Postby Antonio Linares » Thu Dec 31, 2009 2:32 pm

Hakan,

There is a FWH 9.12 31 December build. Please download it and test it.

If there is something wrong, please provide an example to reproduce it, thanks :-)
regards, saludos

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

Re: Bug in Transparent Group

Postby Horizon » Fri Jan 01, 2010 2:27 pm

Antonio,

Result is the same. my sample is below.

Code: Select all  Expand view
#include 'fivewin.ch'


function Main()

   local oWnd

   DEFINE DIALOG oWnd COLOR CLR_WHITE,CLR_BLUE SIZE 600,400
   
   @ 20, 20 TO 100,200 PIXEL OF oWnd TRANSPARENT
     
   @ 60, 20 TO 100,200 PIXEL OF oWnd TRANSPARENT
     
   ACTIVATE DIALOG oWnd CENTER

return nil


First run of app, it has the same error, but when i click outside of the dialog it is OK.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: W3C [Validator] and 76 guests

cron