How to set Color dialogs in TPages when WindowsXP.Manifest ?

How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby Horizon » Sun Oct 18, 2009 10:11 am

Hi,

I try to use TPages. I try TestPag3.prg. I have set the color dlg1 using Dlg1:SetColor(). It is working without using xp manifest. But I use xp manifest.

How Can I solve this?

Thanks in advance.
Regards,

Hakan ONEMLI

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

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby ukoenig » Sun Oct 18, 2009 1:15 pm

Add these red Lines in Sample < Testpag3.prg > :

DEFINE DIALOG oDlg1 STYLE WS_CHILD OF oPages
@ 0.5, 1 BUTTON "+" OF oDlg1 SIZE 10, 10
@ 3, 2 SAY "Normal" OF oDlg1

oPages:AddPage( oDlg1 )

Image

oDlg1:bPainted := { | hDC | GradientFill( hDC, 0, 0, oDlg1:nHeight, oDlg1:nWidth, { { 0.50, 16054371, 8388608 } } ) }

DEFINE DIALOG oDlg2 STYLE WS_CHILD OF oPages

@ 0.5, 1 BUTTON "Sin" OF oDlg2 SIZE 10, 10

@ 3, 2 SAY "Scientific" OF oDlg2

oPages:AddPage( oDlg2 )

Image

oDlg2:bPainted := { | hDC | GradientFill( hDC, 0, 0, oDlg1:nHeight, oDlg1:nWidth, { { 0.50, 16054371, 128 } } ) }

oPages:SetOption( 1 )

return nil

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby Horizon » Mon Oct 19, 2009 12:42 pm

Hi Uwe,

Thank you very much for your answer.

Your gradient solution almost solve my problem. But I have transparent problem with buttons and checkboxes. I also want to remind that I use xp manifest in rc file.

Is there any solution for this problem.
Regards,

Hakan ONEMLI

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

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby PeterHarmes » Mon Oct 19, 2009 1:58 pm

We are having similar problems with check boxes/radio buttons (also folder headers) and i think it might be to do with xHarbour Commercial as i received a sample from another user (think it was Ramesh) which worked fine until i recompiled using xHarbour Commercial.

Uwe,

When we use a gradient filled dialog and drag a dialog over it, the movement of the dragged dialog slows down and becomes jerky. Also we've noticed that radio buttons are no longer transparent - any ideas or recommendations? Also, when a dialog is dragged over another, the header background for a folder fixes itself, Weird!!

Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby nageswaragunupudi » Mon Oct 19, 2009 2:12 pm

please try
Code: Select all  Expand view

oDlg:SetColor( <your colors> )
AEval( oDlg:aControls, { |o| o:SetBrush( oDlg:oBrush ) } )
 
Regards

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

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby Horizon » Mon Oct 19, 2009 2:24 pm

Hi,

nageswaragunupudi wrote:please try
Code: Select all  Expand view

oDlg:SetColor( <your colors> )
AEval( oDlg:aControls, { |o| o:SetBrush( oDlg:oBrush ) } )
 


Unfortunately, It did not worked. It works in normal dialogs. My problem is in TPages.
Regards,

Hakan ONEMLI

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

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby ukoenig » Mon Oct 19, 2009 2:37 pm

I added a Radio to a page for Transparent-Test
Inside a Page, it didn't work. Maybe Transparent is not supported ???

@ 1, 10 RADIO oRad1 VAR nValue ;
ITEMS "&One", "&Two", "T&hree" _3D SIZE 150, 25 ;
HELPID 100, 101, 102 ;
ON CHANGE MsgBeep()
AEval( oRad1:aItems, { | oRad1 | oRad1:lTransparent := .T. } )

Peter,

can You test the Gradient from inside the Tools, if there is the same Effect ?
Open a Preview and move the Dialog around.
The Main-Dialog uses a Gradient as well the 2. Preview-Dialog.
Just let me know about the Result. Here there is no Problem with Speed and Painting.

Image

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby PeterHarmes » Mon Oct 19, 2009 3:06 pm

Uwe,

Your example seems a lot quicker than ours, however, we did notice that the left hand side of the original dialog (to the left of the folder) gets "corrupt" when you drag the preview over it

Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby ukoenig » Mon Oct 19, 2009 5:06 pm

Hello Peter,

All Paintings :

1. Window with Image-Background
2. Calls a Dialog with Folder and Gradient. VTitle-Buttonbar on the Righthand-Side.
3. The Button from the Buttonbar calls a Preview-Dialog with all possible Backgrounds

Maybe You find some useful Informations.

Code: Select all  Expand view

#include "FiveWin.ch"
#include "xBrowse.ch"
#include "Folder.ch"
#include "Slider.ch"
#include "Image.ch"
#include "ttitle.ch"

static oWnd, oDlg, hDC, oFld


FUNCTION MAIN()
LOCAL oBMP1

nWidth := GetSysMetrics(0)
nHeight := GetSysMetrics(1)
lOPEN := .F.


DEFINE WINDOW  oWnd  TITLE "VTitle Painter"  

DEFINE IMAGE oBMP1 FILENAME c_path + "\Images\BACKGRD.JPG"


ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT ( DRAWBITMAP( hdc, oBMP1:hbitmap, 0, 0,;
                    nWidth, nHeight ), W_ALPHA( hDC ) ) ;
ON INIT ( Tools() )  

RETURN ( NIL )

// --------- W-ALPHA-BMP  3 Logos --------------------------------------

FUNCTION W_ALPHA( hDC )
LOCAL oBmp1, oBmp2, oBmp3

cALPHA1 :=  c_path + "\IMAGES\Deco1.BMP"
cALPHA2 :=  c_path + "\IMAGES\Deco2.BMP"
cALPHA3 :=  c_path + "\IMAGES\Deco3.BMP"
// Left / Top
IF File( "&cALPHA1" )
    DEFINE BITMAP oBmp1 FILENAME "&cALPHA1"
    ABPaint( hDC, 730, 30, oBmp1:hBitmap, 220 )
    oBmp1:End()
ENDIF
IF File( "&cALPHA2" )
    DEFINE BITMAP oBmp2 FILENAME "&cALPHA2"
    ABPaint( hDC, 750, 200, oBmp2:hBitmap, 220 )
    oBmp2:End()
ENDIF
IF File( "&cALPHA3" )
    DEFINE BITMAP oBmp3 FILENAME "&cALPHA3"
    ABPaint( hDC, 750, 370, oBmp3:hBitmap, 220 )
    oBmp3:End()
ENDIF

RETURN NIL

// --------- Dialog with Folder and Gradient-Background -----------------------

STATIC FUNCTION Tools()

DEFINE DIALOG oDlg RESOURCE "Maindlg" OF oWnd TRANSPARENT ;
TITLE  "VTitle - Painter       Version 1.0 /  10.09"

REDEFINE FOLDER oFld ID 100 OF oDlg UPDATE ;
PROMPTS "&Background  ", " &Circle  ", "  VTitle-&Body  ", "  &Base  ",  " &VTitle-Size / Pos. ", "  VTitle-&Text  ", " &Buttons  ", " &Devider " ;
DIALOGS "Painter", "Circle", "TBody", "Base", "Background", "TText", "TButtons", "Devider"  FONT oFoldFont // ;

FOLDER_1(oDlg,oFld)  // Background
FOLDER_2(oDlg,oFld)  // Circle
FOLDER_3(oDlg,oFld)  // Body
FOLDER_4(oDlg,oFld)  // Base
FOLDER_5(oDlg,oFld)  // Position
FOLDER_6(oDlg,oFld)  // Title-Text
FOLDER_7(oDlg,oFld)  // Title-Buttons
FOLDER_8(oDlg,oFld)  // Devider

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( SetImages(oDlg,oFld), ;
   GradBrush( oDlg, { { 0.50, 14853684, 16314573 }, ;
   { 0.50, 16314573, 14853684 } }, .T. ), MAKEBAR(oDlg) ) ;
ON PAINT SetFoldGrad( oFld )  

RETURN NIL  

// ------------- VTITLE Buttonbar ---------------------------------

FUNCTION MAKEBAR(oDlg)
LOCAL oBar3, oBar4, oBtn1, oBtn2, oBtn3

nSCR0 := oDlg:nWidth()  // Screen-Width
nSCR17 := oDlg:nHeight()  // Screen-Hight - Title-Height
nSCR4 := GetSysMetrics(4)  // Title-Hight ???

//Title 4 Vertical ( Right )
// Top, Left - Width / Height
@  0, nSCR0 - 100 TITLE oBar3 size 100, nSCR17 of oDlg SHADOW BOTTOMLEFT SHADOWSIZE 1 TOPRIGHT
@  0, nSCR0 - 115 TITLE oBar4 size 15, nSCR17 of oDlg SHADOW BOTTOMLEFT SHADOWSIZE 1 TOPRIGHT

// ------ The Preview-Button ------------------------

@   40,  18 TITLEIMG OF oBar3 BITMAP c_path + "\Images\preview.bmp"  SIZE 45, 45 REFLEX ANIMA LEVEL 255 ;
       ACTION ( aPICTURES2 := aPICTURES1, NEW_TITLE() )
@  120,  20  TITLETEXT OF oBar3 TEXT "Preview"  FONT oProgFont COLOR CLR_BLACK  
@  140,  23  TITLETEXT OF oBar3 TEXT "VTitle"  FONT oButtFont1 COLOR 65535  


RETURN( NIL )

// -------- Folder-Gradient ------------------------------------

FUNCTION SetFoldGrad( oFld )
LOCAL n, oDlg
   
FOR n = 1 to Len( oFld:aDialogs )
      oDlg = oFld:aDialogs[ n ]    
      oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
      oDlg:nWidth, { { 0.50, 14853684, 16314573 }, ;
      { 0.50, 16314573, 14853684 } }, .T. ) }
NEXT

RETURN NIL    

// ------------- Tab-Images ----------------------------

function SetImages(oDlg, oFld)
local oImageList
   
DEFINE IMAGELIST oImageList SIZE 16, 16
   
oImageList:AddMasked( TBitmap():Define( "show",,   oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "show",,     oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",,   oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "show",,     oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "show",,     oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "show",,     oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",,     oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "show",,     oDlg ), nRGB( 192, 192, 192 ) )

oFld:SetImageList( oImageList )
   
return nil  

// -------- Gradient-Brush for Transparent-Painting -----------------------

FUNCTION GradBrush( oDlg, aColors, lPos )
local hDC, hBmp, hBmpOld, oBrush

if Empty( oDlg:oBrush:hBitmap )
      hDC = CreateCompatibleDC( oDlg:GetDC() )
      hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
      hBmpOld = SelectObject( hDC, hBmp )
      GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aColors, lPos )
      DeleteObject( oDlg:oBrush:hBrush )
      oDlg:oBrush:hBitmap = hBmp
      oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
      SelectObject( hDC, hBmpOld )
      oDlg:ReleaseDC()
endif  

RETURN NIL

// ------------- Dialog-Gradient ----------------------------------

STATIC FUNCTION D_GRAD( hDC, oDlg70, aGrad )
local oNewbrush

aRect := GETCLIENTRECT( oDlg70:hWnd )
IF W_DIRECT =  1 // Horizontal
    GradientFill( hDC, 0, 0, oDlg70:nHeight, oDlg70:nWidth, aGrad, .T. )
ELSE  // Vertical
    GradientFill( hDC, 0, 0, oDlg70:nHeight, oDlg70:nWidth, aGrad, .F. )
ENDIF

RETURN NIL

// ------------ Dialog-Color -----------------------------------

STATIC FUNCTION D_COLOR( oDlg70 )
local oNewbrush

DEFINE BRUSH oNewBrush COLOR W_COLOR1
SET BRUSH OF oDlg70 TO oNewBrush
RELEASE BRUSH oNewbrush

RETURN NIL

//------------ Dialog-Brush from BMP ---------------------

FUNCTION DB_IMAGE( oDlg70 )
LOCAL oImage2

cNEWLOGO := "&c_path\IMAGES\" + ALLTRIM(W_BRUSH)
IF ! Empty( cNEWLOGO ) .and. File( "
&cNEWLOGO" )
    DEFINE BRUSH oImage2 FILE "
&cNEWLOGO"
    SET BRUSH OF oDlg70 TO oImage2
    RELEASE BRUSH oImage2
ELSE
    MsgAlert("
No file selected !","Attention" )
ENDIF

RETURN NIL

//------------ Dialog-Image ---------------------

FUNCTION DL_IMAGE( hDC, oDlg70 )
LOCAL oImage2

cNEWLOGO := "
&c_path\IMAGES\" + ALLTRIM(W_IMAGE)

IF ! Empty( cNEWLOGO ) .and. File( "
&cNEWLOGO" )
    aRect := GETCLIENTRECT( oDlg70:hWnd )
    @ 0, 0 IMAGE oImage2 SIZE aRect[4], aRect[3] OF oDlg70  ADJUST
    oImage2:Progress( .f. )
    oImage2:LoadBmp( "
&cNEWLOGO" )
ELSE
    MsgAlert("
No file selected !","Attention" )
ENDIF

RETURN NIL

// ----------- Preview of Dialog-Titles --------------------------------

FUNCTION NEW_TITLE()
LOCAL oDlg70, hDC
LOCAL aGrad1 := { { W_MOVE, W_COLOR1, W_COLOR2 }, ;
                            { W_MOVE, W_COLOR2, W_COLOR1 } }

// Color selected
// -----------------
IF W_BACKGRD = 2
   D_COLOR( oDlg70 )  
ENDIF

// ImageBrush selected
// ------------------------
IF  W_BACKGRD = 4
   DEFINE BRUSH oBrush2 FILENAME c_path + "
\Images\" + ALLTRIM(B_BRUSH)
   DB_IMAGE( oDlg70 )
ENDIF

// ON PAINT needed for Gradient and Image-Background
// ON INIT show a VTitle
// ---------------------------------------------------------------
ACTIVATE DIALOG oDlg70 CENTERED ;
ON INIT ( SHOW_TITLE(oDlg70,oShowFont,oBrush2) ) ;
ON PAINT ( IIF( W_BACKGRD = 1, D_GRAD( hDC, oDlg70, aGrad1 ), NIL ), ; // Gradient selected
                    IIF( W_BACKGRD = 3, DL_IMAGE( hDC, oDlg70 ), NIL ) ) // Image selected 

RETURN( NIL )

// ---------- VTitle-Painting ------------------

FUNCTION  SHOW_TITLE(oDlg70,oShowFont,oBrush2)
LOCAL oBar1, xxx, I
LOCAL nSCR1 := oDlg70:nWidth()  // Screen-Width
LOCAL nSCR2 := oDlg70:nHeight()  // Screen-Hight - Title-Height

//Title 4 Vertical ( Right )
// Top, Left - Width / Height

// A Title
@  B_TOP, B_LEFT TITLE oBar1 SIZE B_WIDTH, B_HEIGHT of oDlg70 SHADOW TOPLEFT SHADOWSIZE BS_MOVE

RETURN ( NIL )


Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to set Color dialogs in TPages when WindowsXP.Manifest ?

Postby Horizon » Wed Oct 21, 2009 6:38 am

Horizon wrote:Hi,

I try to use TPages. I try TestPag3.prg. I have set the color dlg1 using Dlg1:SetColor(). It is working without using xp manifest. But I use xp manifest.

How Can I solve this?

Thanks in advance.


:?
Regards,

Hakan ONEMLI

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests