TGRAPH Repopulate
Re: TGRAPH Repopulate
Very good
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TGRAPH Repopulate
What a great masters we have here
Re: TGRAPH Repopulate
I will create a painter, like I have done for others solution to test
different settings / selections.
Because changing lDegrade to numeric, it is possible, to add more bar-paintings :
0 = NON ( Color )
1 = Gradient horizontal
2 = Gradient vertical
31, 32, 33 = predefined styles ( BORLAND,TILED and BRICKS )
4 = BMP-brush
Another possible change :
Look the difference using the original BMP-structure for background-painting !!!
in Method Paint
Best regards
Uwe
different settings / selections.
Because changing lDegrade to numeric, it is possible, to add more bar-paintings :
0 = NON ( Color )
1 = Gradient horizontal
2 = Gradient vertical
31, 32, 33 = predefined styles ( BORLAND,TILED and BRICKS )
4 = BMP-brush
Another possible change :
Look the difference using the original BMP-structure for background-painting !!!
in Method Paint
Code: Select all
// add new LOCALS !!!
LOCAL oNewbrush, nRow := 0, nCol := 0, nBmpHeight, nBmpWidth
..
// Back area
//
IF ! Empty( ::cBitmap ) .AND. File( AnsiToOem( Lfn2Sfn( ::cBitmap ) ) )
// keep the original BMP-structure !!!
// ------------------------------------------
DEFINE BITMAP oNewbrush FILENAME ::cBitmap
nHeight := oNewbrush:nHeight
nWidth := oNewbrush:nWidth
IF ::nWidth > 0
DO WHILE nRow < ::nHeight
nCol = 0
DO WHILE nCol < ::nWidth
PalBmpDraw( ::hDC, nRow, nCol, oNewbrush:hBitmap )
nCol += nHeight
ENDDO
nRow += nWidth
ENDDO
ENDIF
oNewbrush:End()
...
...
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.
Re: TGRAPH Repopulate
Added Bar-BMP-brushes
IF ::nDegrade = 31 .or. ::nDegrade = 32 .or. ::nDegrade = 33
oBrush := TBrush():New( { "BORLAND", "TILED", "BRICKS" }[ ::nDegrade - 30 ] )
hBru := CreatePatternBrush( oBrush:hBitmap )
FillRect( ::hDC, { nTop, nLeft, nBottom, nRight }, hBru )
ENDIF
It is only a test with ONE Bmp to show, how to display bars with a BMP-brush
IF ::nDegrade = 4
hBmp := ReadBitmap( 0, "Fire.bmp" ) // ::cBitmap is used for the background
oBrush := TBrush():New( ,,,, hBmp )
hBru := CreatePatternBrush( oBrush:hBitmap )
FillRect( ::hDC, { nTop, nLeft, nBottom, nRight }, hBru )
ENDIF
Best regards
Uwe
IF ::nDegrade = 31 .or. ::nDegrade = 32 .or. ::nDegrade = 33
oBrush := TBrush():New( { "BORLAND", "TILED", "BRICKS" }[ ::nDegrade - 30 ] )
hBru := CreatePatternBrush( oBrush:hBitmap )
FillRect( ::hDC, { nTop, nLeft, nBottom, nRight }, hBru )
ENDIF
It is only a test with ONE Bmp to show, how to display bars with a BMP-brush
IF ::nDegrade = 4
hBmp := ReadBitmap( 0, "Fire.bmp" ) // ::cBitmap is used for the background
oBrush := TBrush():New( ,,,, hBmp )
hBru := CreatePatternBrush( oBrush:hBitmap )
FillRect( ::hDC, { nTop, nLeft, nBottom, nRight }, hBru )
ENDIF
Best regards
Uwe
Last edited by ukoenig on Sat Jun 28, 2014 12:08 pm, edited 3 times in total.
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.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: TGRAPH Repopulate
I suggest the sample code for redrawing as methods of the TGraph class.
Regards,
James
Regards,
James
Re: TGRAPH Repopulate
James,
all these paintings are included in method :
METHOD _FillRect( nTop, nLeft, nBottom, nRight, nColor ) CLASS TGraph
Best regards
Uwe
all these paintings are included in method :
METHOD _FillRect( nTop, nLeft, nBottom, nRight, nColor ) CLASS TGraph
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.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: TGRAPH Repopulate
Mr Uwe
Thanks for all your suggestions. They are useful for improvement of the class.
May I ask for a few clarifications?
Please see your suggested code:
When nDegrade == 2, you have used GradientBrush but not Gradient function with .t. as the last parameter. Why did you not use Gradient function itself?
Is it necessary to use "File( AnsiToOem( Lfn2Sfn( ::cBitmap ) ) )"? Is "File( ::cBitmap ) not enough?
Thanks for all your suggestions. They are useful for improvement of the class.
May I ask for a few clarifications?
Please see your suggested code:
Code: Select all
IF ::nDegrade = 1
nMid:=(nRight-nLeft)/2
Gradient( ::hDC, { nTop, nLeft, nBottom, nRight-nMid }, nColor, LightColor(175,nColor), .F. )
Gradient( ::hDC, { nTop, nLeft+nMid, nBottom, nRight }, LightColor(175,nColor), nColor, .F. )
ELSE
hBru = GradientBrush( ::hDC, 0, 0, 0, nTop, { { 0, nColor, LightColor(175,nColor) } }, .T. )
FillRect( ::hDC, { nTop, nLeft, nBottom, nRight }, hBru )
ENDIF
Is it necessary to use "File( AnsiToOem( Lfn2Sfn( ::cBitmap ) ) )"? Is "File( ::cBitmap ) not enough?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: TGRAPH Repopulate
Mr. Rao,
I'm working on a extended version of Your sample
It will be possible, to change with the graph-painter the values,
with the dialog-painter the dialog-background.
Because of more than 30 possible graph-values, it might be useful.
Yes not needed ( ! didn't change it )
AnsiToOem( Lfn2Sfn( ::cBitmap ) ) )
I still have to test again the different gradient and brush settings.
Best regards
Uwe
I'm working on a extended version of Your sample
It will be possible, to change with the graph-painter the values,
with the dialog-painter the dialog-background.
Because of more than 30 possible graph-values, it might be useful.
Yes not needed ( ! didn't change it )
AnsiToOem( Lfn2Sfn( ::cBitmap ) ) )
I still have to test again the different gradient and brush settings.
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.
Re: TGRAPH Repopulate
I found a gradient-solution ( maybe to complicated ),
better possible, to make the graph-area transparent using the dialog-background.
best regards
Uwe
better possible, to make the graph-area transparent using the dialog-background.
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.
Re: TGRAPH Repopulate
9 possible combinations between dialog- and graph :
// Dialog ( values for function-call )
// --------------------------------------
nDStyle := 2 // 1 = color / 2 = Gradient / 3 = Brush / 4 = Image
nDColorF := 16765559
nDColorB := LightColor( 175, nDColorF )
nDTxtColor := 255
nDGradpos := 0
LDDirect := .T.
cDBrush := "Marble.bmp"
cDImage := "Picture3.jpg"
// Graph adjusted to dialog background
// -------------------------------------------
oGraph:nType := 1
oGraph:nMaxVal := 2000
oGraph:nClrBack := 16765559 // Background color
oGraph:l3D := .T.
oGraph:nDegrade := 2 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
Select one of the background-styles
//oGraph:cBitmap := "Color" // Dialog nDStyle = 1
//oGraph:cBitmap := "Gradient" // Dialog nDStyle = 2
//oGraph:cBitmap := "Marble.bmp" // Dialog nDStyle = 3
Color
// Dialog
// ----------
nDStyle := 1
// Graph
// ----------
oGraph:nDegrade := 0 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
oGraph:cBitmap := "Color"
Brush
// Dialog
// ----------
nDStyle := 3
// Graph
// ----------
oGraph:nDegrade := 0 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
oGraph:cBitmap := "Marble.bmp"
Gradient
Still have to check the graph-gradient-height !!!
// Dialog
// ----------
nDStyle := 2
// Graph
// ----------
oGraph:nDegrade := 0 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
oGraph:cBitmap := "Gradient"
Style change
The first graph-background-tests :
// Dialog ( values for function-call )
// --------------------------------------
nDStyle := 2 // 1 = color / 2 = Gradient / 3 = Brush / 4 = Image
nDColorF := 16765559
nDColorB := LightColor( 175, nDColorF )
nDTxtColor := 255
nDGradpos := 0
LDDirect := .T.
cDBrush := "Marble.bmp"
cDImage := "Picture3.jpg"
// Graph adjusted to dialog background
// -------------------------------------------
oGraph:nType := 1
oGraph:nMaxVal := 2000
oGraph:nClrBack := 16765559 // Background color
oGraph:l3D := .T.
oGraph:nDegrade := 2 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
Select one of the background-styles
//oGraph:cBitmap := "Color" // Dialog nDStyle = 1
//oGraph:cBitmap := "Gradient" // Dialog nDStyle = 2
//oGraph:cBitmap := "Marble.bmp" // Dialog nDStyle = 3
Color
// Dialog
// ----------
nDStyle := 1
// Graph
// ----------
oGraph:nDegrade := 0 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
oGraph:cBitmap := "Color"
Brush
// Dialog
// ----------
nDStyle := 3
// Graph
// ----------
oGraph:nDegrade := 0 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
oGraph:cBitmap := "Marble.bmp"
Gradient
Still have to check the graph-gradient-height !!!
// Dialog
// ----------
nDStyle := 2
// Graph
// ----------
oGraph:nDegrade := 0 // 0 = Color / 1 = Grad Horiz. / 2 = Grad vert.
oGraph:cBitmap := "Gradient"
Style change
The first graph-background-tests :
Code: Select all
// Back area
//
IF ! Empty( ::cBitmap ) .OR. ( Empty( ::oPrn ) .AND. ::nType != GRAPH_TYPE_PIE )
IF UPPER ( ::cBitmap ) = "COLOR"
//MsgAlert( "Color" )
hBru := CreateSolidBrush( ::nClrBack )
hOld := SelectObject( ::hDC, hBru )
FillRect( ::hDC, { 0, 0, ::nHeight, ::nWidth }, hBru )
SelectObject( ::hDC, hOld )
DeleteObject( hBru )
ELSEIF UPPER ( ::cBitmap ) = "GRADIENT"
//MsgAlert( "Gradient" )
hBru := GradientBrush( ::hDC, 0, 0, ::nHeight, ::nWidth, ;
{ { 0, LightColor( 175, ::nClrBack ), ::nClrBack } }, .T. )
hOld := SelectObject( ::hDC, hBru )
FillRect( ::hDC,{ 0, 0, ::nHeight, ::nWidth }, hBru )
SelectObject( ::hDC, hOld )
DeleteObject( hBru )
ELSEIF File( ::cBitmap )
DEFINE BITMAP oNewbrush FILENAME ::cBitmap
nHeight := oNewbrush:nHeight
nWidth := oNewbrush:nWidth
IF ::nWidth > 0
DO WHILE nRow < ::nHeight
nCol = 0
DO WHILE nCol < ::nWidth
PalBmpDraw( ::hDC, nRow, nCol, oNewbrush:hBitmap )
nCol += nHeight
ENDDO
nRow += nWidth
ENDDO
ENDIF
oNewbrush:End()
ENDIF
ENDIF
Last edited by ukoenig on Mon Jun 30, 2014 6:13 pm, edited 1 time in total.
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.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TGRAPH Repopulate
Dear Uwe,
You are our Graphics master, no doubt about it
Thanks so much!
You are our Graphics master, no doubt about it
Thanks so much!
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: TGRAPH Repopulate
Uwe,
RE: New methods of TGraph
I was mainly referring to adding methods to clear existing data, so new data could be added.
James
RE: New methods of TGraph
I was mainly referring to adding methods to clear existing data, so new data could be added.
James
Re: TGRAPH Repopulate
Very cool. How would you accomplish the same if using resources?
Thank you
Harvey
Harvey
Re: TGRAPH Repopulate
Harvey,
there is still a lot to do.
Because of over 40 possible settings,
I'm working on a painter, to change and test everything at runtime.
There is a project-file, to save all values.
Best regards
Uwe
there is still a lot to do.
Because of over 40 possible settings,
I'm working on a painter, to change and test everything at runtime.
There is a project-file, to save all values.
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.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: TGRAPH Repopulate
Same logic, except that you replace @ r, c syntax with REDEFINE syntax. For samples of rc files for TGraph, please see testfldg.rc and testdisk1.rc in the samples folder.hag wrote:Very cool. How would you accomplish the same if using resources?
For better understanding of the class there are some good samples posted by the author of the class in the samples folder.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India