I got a problem, trying to change colors and bitmaps from inside folders :
I want to define new dialog-colors inside a folder with a bitmap-preview
and than show the result in a extra preview-dialog.
I don't want to change the Main-dialog-background.
The preview is a extra-dialog and has nothing to do with the folder.
The source, to define a color/brush for a bitmap and show the result in a extra dialog-preview :
- Code: Select all Expand view
A Preview-Bitmap in folder-page 7
---------------------------------------
REDEFINE BITMAP oBmp22 ID 145 ADJUST RESOURCE "DlgSampl" OF oFld:aDialogs[7]
oBmp22:bPainted := { |hDC| OnPaint5( hDC, oBMP22) }
// ---------- The Bitmap-Refresh-Function -------------------------------------
FUNCTION ONPAINT5( hDC, oBmp22 )
LOCAL oBrush1
IF DLG_STYLE1 < 3
IF nHEADGRAD = 1
aGrad1 := { { nMOVE1, BR_COLOR1, BR_COLOR2 }, ;
{ nMOVE1, BR_COLOR2, BR_COLOR1 } }
ENDIF
IF nHEADGRAD = 2
aGrad1 := { { nMOVE1, BR_COLOR1, BR_COLOR1 }, ;
{ nMOVE1, BR_COLOR1, BR_COLOR1 } }
ENDIF
ENDIF
IF DLG_STYLE1 > 2 .and. DLG_STYLE1 < 5
IF nHEADGRAD = 1
aGrad1 := { { nMOVE7, DLG_COLOR1, DLG_COLOR2 }, ;
{ nMOVE7, DLG_COLOR2, DLG_COLOR1 } }
ENDIF
IF nHEADGRAD = 2
aGrad1 := { { nMOVE7, DLG_COLOR1, DLG_COLOR1 }, ;
{ nMOVE7, DLG_COLOR1, DLG_COLOR1 } }
ENDIF
ENDIF
// DLG_STYLE1
// 1 = Dialog-backgroung from xBrowse-Header Horizontal
// 2 = Dialog-background from xBrowse-Header Vertical
// 3 = New Gradient for Dialog-background Horizontal
// 4 = New Gradient for Dialog-background Vertical
// 5 = Mono-Color for Dialog-background from 1. xBrowse-header-color
// 6 = Brush-selection for Dialog-background
IF DLG_STYLE1 < 5
IF DLG_STYLE1 = 1 .or. DLG_STYLE1 = 3
GradientFill( hDC, 0, 0, 193, 255, aGrad1, .T. )
ENDIF
IF DLG_STYLE1 = 2 .or. DLG_STYLE1 = 4
GradientFill( hDC, 0, 0, 193, 255, aGrad1, .F. )
ENDIF
ENDIF
IF DLG_STYLE1 = 5
DEFINE BRUSH oBrush1 COLOR DLG_COLOR1
FillRect(oBmp22:hDC, GetClientRect( oBmp22:hWnd ), ;
oBrush1:hBrush )
oBrush1:End()
ENDIF
IF DLG_STYLE1 = 6
DEFINE BRUSH oBrush1 FILENAME LOGO3
FillRect(oBmp22:hDC, GetClientRect( oBmp2:hWnd ), oBrush1:hBrush )
oBrush1:End()
ENDIF
RETURN NIL
//--------- TEST-DATABASE ( The Action from the Preview-Button ) -------------//
STATIC FUNCTION Test_Browse5()
Local oDlg5, oLbx30, oBrush5, oBmp5
Local cAlias := cGetNewAlias( "CUST" )
LOCAL oBmp1, nBMPheight
nFOR := 1
REQUEST DBFCDX
USE CUSTOMER NEW ALIAS (cAlias) SHARED VIA "DBFCDX"
GO TOP
DEFINE DIALOG oDlg5 RESOURCE "TESTSOURCE"
....
....
....
ACTIVATE DIALOG oDlg5 CENTERED ;
ON PAINT DLG_BACK( oDlg5 ) ;
ON INIT ( oDlg5:Move( 30, 10, oDlg5:nWidth, oDlg5:nHeight, .f. ), ;
SHOW_BAR( oDlg5 ), OBRW_PEN( oLbx30) )
(cAlias)->( dbCloseArea() )
RETURN ( NIL )
The color-defines for a new dialog-background :
If i change to the main-dialog with the preview-button.
As soon, the button gets the focus,
the tooltipp shows the color of the bitmap from the folder-page.
I do the preview :
I close the preview and the main-dialog got the color from
the preview-dialog.
I don't know, why the main-dialog uses colors, defined inside a folder-page to show in a extra dialog.
I think, it has to do something with < hDC >.
Regards
Uwe