FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Painting problem in the New Sample GradBrus.Prg
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 10:39 AM
Dear Mr.Antonio,

In FWH 9.02 new sample \Fwh\Samples\GradBrus.Prg the parent window is gettnng painted with the Gradiant colours of the Dialog.
To repeat the error, Please move the Gradiant colour Dialog inside the main window. Is this a bug ?

Screen Snapshot



Regards

Anser
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 12:05 PM

Anser,

Here it is working fine on Windows 7.

Here you have the EXE, please run this one, thanks:

http://www.mediafire.com/?sharekey=414c ... 8114394287

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 12:27 PM
Antonio, in XP and Vista are the same problem. When i leave the "brushed" dialog, the main window becomes (when resize?) also the brush. See also this topic http://forums.fivetechsupport.com/viewtopic.php?f=3&t=13333&start=60 and previously.
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 12:55 PM
Hello,

I tested Antonio's Test-file and got a paint-effect on the main-window.
What is the difference with the new < Gradbrush > ?
I use < GradientFill > on Dialogs without any problems.



Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 01:15 PM

Dear Mr.Antonio,

I am using XP Professional and the screen snapshot which I pasted above is the result of running the sample on XP Professional. I have only 1 PC running Windows 7 and I am out of office now. Shall let u know the feedback tomorrow.

Dear Uwe,

As per the new GradBus.Prg you will be able to use Transparent Checkbox and Radio controls. If I am not wrong, prior to this we had Transparency problems with Radio and Checkbox contols on a Gradiant background. They get Transparency effect only when a Gradient BMP is used as BRUSH. With Antonio's new GradBus Sample, we don't have to create BMP. May be I am wrong, just dumping what I had in my brain.

Regards

Anser

:D

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 01:26 PM

Günther,

We have just tested our provided EXE in Vista and also works fine.

Have you tested our EXE ? thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 01:45 PM

Antonio, yes i tested your sample exe also in Vista. When i leave the "brushed" dialog and resize the main window, the main window suddenly is brushed with the brush from the closed dialog. Please try also gets and there background!!

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 02:01 PM

Ok, I found where the different behaviors are coming from:

I use a gray color for the window color, so it is not the white brush and it does not gets changed from the application. We need to review this.

Please change your window color (in Windows colors settings) to gray and you will see that then it behaves ok.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 02:25 PM

Antonio, is the function GradientBrush() not included in FWH?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 02:29 PM

Günther,

Not yet.

Actually it is included in samples\GradBrus.prg so we can easily modify it and test it.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Wed Feb 25, 2009 02:49 PM

Antonio, i found also, after calling a dialog with Gradientbrush() this brush are used from other dialogs without Gradientbrush(). BUT ONLY, if this dialogs use the clausula ... COLOR x,y.
In your exe the "Another" - dialog not use any color. Please test the "Another" dialog with an ...COLOR clausula.

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Thu Feb 26, 2009 07:32 AM
Dear Mr.Antonio,
Anser,

Here it is working fine on Windows 7.

Here you have the EXE, please run this one, thanks:
http://www.mediafire.com/?sharekey=414c ... 8114394287

I am unable to download the zip from mediafire site, till now unsuccessful. I even tried 2 different ISP's but the same result. May be a temporary problem with the mediafire site.

Regards

Anser
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Thu Feb 26, 2009 11:18 AM

Anser, Günther,

In FWH\samples\GradBrus.prg please replace:

DEFINE BRUSH oBrush COLOR CLR_WHITE

with

DEFINE BRUSH oBrush COLOR CLR_CYAN

and it will work fine :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Thu Feb 26, 2009 11:48 AM
Antonio, all the sideeffects are come from the array aBrushes in TBRUSH. You are make automatically a white brush in TDIALOG. And in this brush you write with gradientbrush() hBitmap and hBrush new. On another dialog this brush is used also, if it is in aBrushes present. And now are the old hBrush and hBitmap is used. If you define an brush with another color as you say, the situation is the same on all dialogs using this brush-color.
Possible way is to check aBrushes for reusing a brush in TBRUSH! For me this codeextension is ok.

Code (fw): Select all Collapse
   if ( nAt := AScan( ::aBrushes, {|oBrush| oBrush:cStyle    == ::cStyle    .and. ;
                                            oBrush:nRGBColor == ::nRGBColor .and. ;
                                            oBrush:cBmpFile  == ::cBmpFile  .and. ;
                                            oBrush:cBmpRes   == ::cBmpRes } ) ) > 0

    if !empty(::aBrushes[ nAt ]:hBitmap) .and. ( empty(::aBrushes[ nAt ]:cBmpFile) .and. empty(::aBrushes[ nAt ]:cBmpRes) )
             ::aBrushes[ nAt ]:end()
    else
          #ifndef __XPP__
             Self := ::aBrushes[ nAt ] // This is not permited with XBase++
             ::nCount++
             return Self
          #else
             ::aBrushes[ nAt ]:nCount++
             return ::aBrushes[ nAt ]
          #endif
    endif
    
   endif
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting problem in the New Sample GradBrus.Prg
Posted: Thu Feb 26, 2009 01:13 PM

Günther,

Brushes objects are reused in FWH to reduce the consume of GDI memory. If we have a white brush and we change its hBrush then all objects that use that white brush, will have it changed.

Thats why if you select a non used brush color, like cyan, and change its hBrush, it will not affect to other objects brushes, unless they use a cyan brush also.

regards, saludos

Antonio Linares
www.fivetechsoft.com