Bug in brush gradient?
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Bug in brush gradient?
Another erratic problem: sometimes the dialog with the gradient suddenly becomes transparent (never saw under XP, only under Vista and Win7). Any ideas?
EMG
EMG
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Bug in brush gradient?
Can you make it more clear please? Does the dialog suddenly behave like a transparent dialog? Or the entire dialog becomes transparent showing the background behind the dialog like when using null brush?
Can you post a sample code?
Can you post a sample code?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bug in brush gradient?
nageswaragunupudi wrote:Can you make it more clear please? Does the dialog suddenly behave like a transparent dialog? Or the entire dialog becomes transparent showing the background behind the dialog like when using null brush?
Yes, like null brush.
nageswaragunupudi wrote:Can you post a sample code?
Sorry, no. The problem is erratic. I can't reproduce it consistently in a sample.
EMG
Re: Bug in brush gradient?
Enrico,
I'm using VISTA.
I changed my Background-function and it works on Windows and Dialogs without Problem.
As well it works perfect together with TFolderex-tabs.
Maybe have a look at it ( extra Gradient-function ).
Best Regards
Uwe
I'm using VISTA.
I changed my Background-function and it works on Windows and Dialogs without Problem.
As well it works perfect together with TFolderex-tabs.
Maybe have a look at it ( extra Gradient-function ).
Code: Select all | Expand
//--------- Backgrounds ------------------------
// c_path := CURDRIVE() + ":\" + GETCURDIR()
// Samples :
// ACTIVATE WINDOW oWnd MAXIMIZED ;
// ON INIT WND_BRUSH( oWnd, ; // Object to fill
// nWStyle, ; // 1=Color, 2=Gradient, 3=Brush, 4=Image, 5-7= Pred.-styles
// lWGrad, ; // .T. = vertical, .F. = horizontal
// nWColorF, ; // 1.Gradient- or plain Color with Style = 1
// nWColorB, ; // 2. Gradient-color
// nWGradPos, ; // Color-position 0 - 1
// cWBrush, ; // Brush
// cWImage ) // Image
// Embedded inside the Dialog, can be changed at Runtime
//
// DEFINE DIALOG oDlg SIZE 950, 600 OF oWnd PIXEL TRANSPARENT ;
// FONT oFont1 TITLE 'Title / xBrowse and Border'
//
// for Brush and Image only Filename, no Path
// WND_BRUSH( oDlg, nDStyle, lDGrad, nDColorF, nDColorB, nDPos, cDBrush, cDImage )
//
// ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
FUNCTION WND_BRUSH( cControl, nStyle, lDirect, nVColor, nBColor, nMove, cBrush, cImage )
LOCAL hDC, oBrush, oTmp
LOCAL aRect := GETCLIENTRECT( cControl )
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
IF nStyle = 1 // Color
DEFINE BRUSH oBrush COLOR nVColor
SET BRUSH OF cControl TO oBrush
RELEASE BRUSH oBrush
ENDIF
IF nStyle = 2 // Gradient
hDC = CreateCompatibleDC( cControl:GetDC() )
hBmp = CreateCompatibleBitMap( cControl:hDC, cControl:nWidth, cControl:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, cControl:nHeight, cControl:nWidth, aGrad, lDirect )
DeleteObject( cControl:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
cControl:ReleaseDC()
cControl:SetBrush( oBrush )
RELEASE BRUSH oBrush
ENDIF
IF nStyle = 3 // BMP-Brush
IF File( c_path + "\bitmaps\" + cBrush )
DEFINE BRUSH oBrush FILE c_path + "\Bitmaps\" + cBrush
SET BRUSH OF cControl TO oBrush
RELEASE BRUSH oBrush
ELSE
MsgAlert( "Cannot load : " + CRLF + ;
c_path + "\bitmaps\" + cDBrush, "Error" )
ENDIF
ENDIF
IF nStyle = 4 // Image
IF File( c_path + "\bitmaps\" + cImage )
DEFINE BRUSH oBrush FILE c_path + "\Bitmaps\" + cImage
SET BRUSH OF cControl TO oBrush
RELEASE BRUSH oBrush
ELSE
MsgAlert( "Cannot load : " + CRLF + ;
c_path + "\bitmaps\" + cDImage, "Error" )
ENDIF
ENDIF
IF nStyle = 5 // Style 1
DEFINE BRUSH oBrush STYLE BORLAND
SET BRUSH OF cControl TO oBrush
RELEASE BRUSH oBrush
ENDIF
IF nStyle = 6 // Style 2
DEFINE BRUSH oBrush STYLE BRICKS
SET BRUSH OF cControl TO oBrush
RELEASE BRUSH oBrush
ENDIF
IF nStyle = 7 // Style 3
DEFINE BRUSH oBrush STYLE TILED
SET BRUSH OF cControl TO oBrush
RELEASE BRUSH oBrush
ENDIF
RETURN NIL
Best 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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bug in brush gradient?
ukoenig wrote:Enrico,
I'm using VISTA.
I changed my Background-function and it works on Windows and Dialogs without Problem.
Yes, I know. I'm unable to reproduce the problem too. But my clients do and they sent me a screenshot of the problem.
EMG
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Bug in brush gradient?
Mr. EMG
Can we also know the FWH version used to build the application?
I expect that the brush was created in the ON INIT clause using the logic that was popular till gradient brushes were introduced.
I have a feeling that the way the gradient brushes were created in the init clause and the way the TBrush class compares a new brush with earlier brushes sometimes could result in destruction of the previous gradient brush.
Can we also see a sample that shows your usual way of creating the gradient brush in the init clause?
I *think* the present implementation of gradient/image brushes would not have such a problem.
Can we also know the FWH version used to build the application?
I expect that the brush was created in the ON INIT clause using the logic that was popular till gradient brushes were introduced.
I have a feeling that the way the gradient brushes were created in the init clause and the way the TBrush class compares a new brush with earlier brushes sometimes could result in destruction of the previous gradient brush.
Can we also see a sample that shows your usual way of creating the gradient brush in the init clause?
I *think* the present implementation of gradient/image brushes would not have such a problem.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bug in brush gradient?
No, I'm using the present implementation as available in latest FWH release.
EMG
EMG
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Bug in brush gradient?
Enrico Maria Giordano wrote:No, I'm using the present implementation as available in latest FWH release.
EMG
Then we need to do more extensive tests with a number of gradient dialogs in one application. I suggest let us give ourselves some time for this.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Bug in brush gradient?
I do not know if you need to help
I use a gradient (first attempts), and sometimes I was going ...
Then I removed the "IF" and now all ok
STATIC FUNCTION GradBrush( oDlgK,difc,colfinA,colfinB,tgr )
local hDC, hBmp, hBmpOld,obrush
* if Empty( oDlgK:oBrush:hBitmap )
hDC = CreateCompatibleDC( oDlgK:GetDC() )
hBmp = CreateCompatibleBitMap( oDlgK:hDC, oDlgK:nWidth, oDlgK:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradColor( hDC, {0, 0, oDlgK:nHeight, oDlgK:nWidth-difc }, colfinA, colfinB,tgr ) // da TSBUTTON
* Gradient( hDC, {0, 0, oDlgK:nHeight, oDlgK:nWidth }, rgb(250, 255, 255),colfinB ,.T. )
DeleteObject( oDlgK:oBrush:hBrush )
oDlgK:oBrush:hBitmap = hBmp
oDlgK:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlgK:ReleaseDC()
* endif
RETURN NIL
Saluti
Stefano
I use a gradient (first attempts), and sometimes I was going ...
Then I removed the "IF" and now all ok
STATIC FUNCTION GradBrush( oDlgK,difc,colfinA,colfinB,tgr )
local hDC, hBmp, hBmpOld,obrush
* if Empty( oDlgK:oBrush:hBitmap )
hDC = CreateCompatibleDC( oDlgK:GetDC() )
hBmp = CreateCompatibleBitMap( oDlgK:hDC, oDlgK:nWidth, oDlgK:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradColor( hDC, {0, 0, oDlgK:nHeight, oDlgK:nWidth-difc }, colfinA, colfinB,tgr ) // da TSBUTTON
* Gradient( hDC, {0, 0, oDlgK:nHeight, oDlgK:nWidth }, rgb(250, 255, 255),colfinB ,.T. )
DeleteObject( oDlgK:oBrush:hBrush )
oDlgK:oBrush:hBitmap = hBmp
oDlgK:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlgK:ReleaseDC()
* endif
RETURN NIL
Saluti
Stefano
FWH 14.11 + xHarbour + bcc582
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact: