Page 1 of 1

BackGround Painting (SOLVED)

PostPosted: Sun Feb 24, 2013 3:04 am
by Bayron
Hi all,
I have the following problem when using tFolderX:

Check Boxes & Group Boxes:
Image

I use SetDlgGradient()...

Anyone knows of a way to fix this...???

Re: BackGround Painting

PostPosted: Sun Feb 24, 2013 11:10 am
by ukoenig
Hello Bayron,

using a folder is different. You can download a working sample.
Folder-Brush, Color, Gradient and image.
Please remember : changing the radio- and Checkbox-textcolor from black to defined,
only works without XPMANIFEST

Download ( different backgrounds ) :
http://www.pflegeplus.com/fw_downloads/testfld1.zip

Different backgrounds for each folderpage :

Image

Using :
SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )
will ignore the different background-selections and the folder will be transparent
( shows gradient from dialog )
To test it, disable the brushdefine ON INIT and enable SetDlgGradient !!!!

Download ( using XPMANIFEST : black textcolor for Radios and checkboxes ) :
http://www.pflegeplus.com/fw_downloads/testfld2.zip

SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )

REDEFINE FOLDEREX oFld ID 110 PROMPT "Page 1", "Page 2", "Page 3", "Page 4";
BITMAPS "new", "new", "new", "new";
DIALOGS "sub1", "sub2", "sub1", "sub2" ;
ROUND 5

// Disable the red lines from sample !
// F_BACKGRD( oFld, 550, 300 ) // no! needed

oFld:lTransparent := .T.
oFld:nFolderHeight := 30
oFld:nSeparator := 10
oFld:bClrText := {| o, n | 128 }
oFld:oFont := oFont

// each Folderpage is defined in a extra function
( to keep the main-dialog small in size )


PAGE1( oFld)
PAGE2( oFld)
PAGE3( oFld)
PAGE4( oFld)

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT DLG_BACK( oDlg, 2, .T., 16038911, 16777215, 0.5, "Marble.bmp", "Backgrd-jpg" ) ;
VALID MsgYesNo( "Do you want to end?" )

without XPMANIFEST ( RED textcolor selected )

Image

Best regards
Uwe :lol:

Re: BackGround Painting

PostPosted: Mon Feb 25, 2013 6:44 am
by Bayron
Hi Uwe,

Your sample works perfectly...
But for some reason It does not work for me in my main program...
I have done everything from:
changing the manifest file
changing my code
Saving my .res file to .rc and check that everything is the same

Tomorrow I will reconstruct everything from scratch using your sample as base...
But I wonder if you can explain the reason why this happens when using the XPMANIFEST...????

Re: BackGround Painting

PostPosted: Mon Feb 25, 2013 9:51 am
by ukoenig
Hello Bayron,

It is the reason, I show complete working samples, not just a few lines,
to get a overview, how it works together.
There are 2 !!! samples.
One sample uses my functions WITH XPManifest but NOT using => SetDlgGradient( {...
The second works as well without my functions.
XPManifest only belongs to the Radio- and checkbox textcolors not to work in sample 2.
You can seperate the text from radios and checkboxes, if You need a different textcolor.

Best Regards
Uwe :lol:

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 4:35 am
by Bayron
Thanks Uwe,
I really appreciate the effort you made to provide me with this sample...
I'm sure I will solve the problem with this samples...
But right now I am doing a complete rewrite of my application, and it will take me some time...

Thank you again...

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 11:03 am
by ukoenig
Remember SetDlgGradient is GLOBAL !!!

Define a extra dialog-style using global SetDlgGradient

Image

FUNCTION MAIN()
local oDlg1, oBtn1, oBtn2

SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )

DEFINE DIALOG oDlg1 FROM 50, 50 TO 300, 400 ;
TITLE "Dialog using SetDlgGradient" PIXEL TRANSPARENT

@ 35, 40 BUTTON oBtn1 PROMPT "&Next" SIZE 40, 20 OF oDlg1 PIXEL ;
ACTION DIALOG2()

@ 35, 100 BUTTON oBtn2 PROMPT "&Quit" SIZE 40, 20 OF oDlg1 PIXEL ;
ACTION oDlg1:End()

ACTIVATE DIALOG oDlg1 ;
ON INIT oDlg1:Move(50, 50)

RETURN NIL

// -----------------------------

FUNCTION DIALOG2()
local oDlg2, oBtn1, oBtn2

SetDlgGradient() // Disabled

DEFINE DIALOG oDlg2 FROM 50, 50 TO 300, 400 ;
TITLE "A EXTRA Dialog-background" PIXEL TRANSPARENT

@ 35, 40 BUTTON oBtn1 PROMPT "&Next" SIZE 40, 20 OF oDlg2 PIXEL ;
ACTION ( SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } ), ;
DIALOG3() )

@ 35, 100 BUTTON oBtn2 PROMPT "&Quit" SIZE 40, 20 OF oDlg2 PIXEL ;
ACTION oDlg2:End()

ACTIVATE DIALOG oDlg2 ;
ON INIT ( DLG_BACK( oDlg2, .T., 16038911, 16777215, 0.5 ), ;
oDlg2:Move( 150,150 ) )

// Enable
SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )

RETURN NIL

// -----------------------------

FUNCTION DIALOG3()
local oDlg3, oBtn1

DEFINE DIALOG oDlg3 FROM 150, 150 TO 400, 600 ;
TITLE "Back to => SetDlgGradient" PIXEL TRANSPARENT

@ 35, 60 BUTTON oBtn1 PROMPT "&Quit" SIZE 40, 20 OF oDlg3 PIXEL ;
ACTION oDlg3:End()

ACTIVATE DIALOG oDlg3 ;
ON INIT oDlg3:Move(250, 250)

RETURN NIL

// --------

FUNCTION DLG_BACK( oWnd, lDirect, nColor1, nColor2, nMove )
local oBrush

aGrad := { { nMove, nColor1, nColor2 }, { nMove, nColor2, nColor1 } }
hDC = CreateCompatibleDC( oWnd:GetDC() )
hBmp = CreateCompatibleBitMap( oWnd:hDC, oWnd:nWidth, oWnd:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oWnd:nHeight, oWnd:nWidth, aGrad, lDirect ) // .T. = Vertical
DeleteObject( oWnd:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
ReleaseDC(hDC)

oWnd:SetBrush( oBrush )
oBrush:End()

RETURN( NIL )

Best Regards
Uwe :lol:

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 11:26 am
by Bayron
Uwe thanks for all your explanations...
Right now I am thinking on going back to individual painting of dialogs, because of the problems I have with SetDlgGradient(), specifically with folders...

I'll see what I come up with....

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 12:32 pm
by Silvio.Falconi
this problem is old...
We have allready modified this error (Tgroup class) two year ago but perhaps Linares not included the modifications on future package

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 1:30 pm
by Otto

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 2:00 pm
by byte-one
Otto, BRAVO!

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 2:31 pm
by Silvio.Falconi
Otto,
Ich kann nicht lachen, ich habe zahnschmerzen !!!!!!!!
so viele Fabeln sechs Fall eine Frau? Nur Frauen erzählen viele Geschichten

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 7:35 pm
by Massimo Linossi
Your teeth? It 's all your head that does not "run ok".

Re: BackGround Painting

PostPosted: Tue Feb 26, 2013 9:24 pm
by Silvio.Falconi
Dear Otto,
Why are you always trying to write nonsense?

You are always trying to offend me constantly ...

The problem with this class (tgroup) has been corrected by Emg long time ago

but as so often mistakes are not saved and we have to recompile the object classes along

with those changed as was the case for so long with the class rpreview

or with the class msgbar or msgitem.

But you continue to offend me not knowing what the real problem

But what you are trying to get by in this way ?


Dear Massimo
with you do not speak anymore after all the crap you wrote to me in private when you told me to be older than me and you told me that " I was a sperm" when you was born
this is a technical forum, or you think it's just a place to offend me constantly ?

Re: BackGround Painting

PostPosted: Wed Feb 27, 2013 7:43 am
by StefanHaupt
Bayron,

have a look at these changes in TGroup.prg.

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=22940&hilit=tgroup

For me everything is working fine, even the transparent groupheader.

Re: BackGround Painting

PostPosted: Wed Feb 27, 2013 1:07 pm
by Bayron
Thanks Stefan,

This way the problem with the painting of the groups was fixed for me...

I also solved the problem with the checkboxes removing this function from my project:

Code: Select all  Expand view
//FUNCTION IsAppThemed()
//RETURN .f.