Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DynamicBackcolor

Status
Not open for further replies.

mimosa

IS-IT--Management
Apr 4, 2002
25
US
Hi,
Thanks for any help
I use 2forms 1st calls the 2nd (not formset) , 2nd contains a grid in which I use colors according to the conditions below but the conditions all are not checked only the last one was cheched,I do not know in which evenement using this program for the moment I have use it in evenement the before and afterrowcolumnchange:
[Do case
Case article.qut_stk=0 and article.qut_conf>0
Thisform.grid1.SetAll("dynamicforecolor", ;
"IIF(article.qut_stk=0 and article.qut_conf>0, RGB(255,255,255), RGB(0,0,0))", "Column")
Thisform.grid1.SetAll("dynamicbackcolor", ;
"IIF(article.qut_stk=0 and article.qut_conf>0, RGB(145,72,72), RGB(255,255,255))", "Column")

Case article.qut_stk>0 and article.flag1=3
Thisform.grid1.SetAll("dynamicforecolor", ;
"IIF(article.qut_stk>0 and article.flag1=3, RGB(255,255,255), RGB(0,0,0))", "Column")
Thisform.grid1.SetAll("dynamicbackcolor", ;
"IIF(article.qut_stk>0 and article.flag1=3, RGB(187,119,119), RGB(255,255,255))", "Column")

Case article.qut_stk>0 and article.flag1=2
Thisform.grid1.SetAll("dynamicforecolor", ;
"IIF(article.qut_stk>0 and article.flag1=2, RGB(255,255,255), RGB(0,0,0))", "Column")
Thisform.grid1.SetAll("dynamicbackcolor", ;
"IIF(article.qut_stk>0 and article.flag1=2, RGB(255,102,102), RGB(255,255,255))", "Column")

Case article.qut_stk>0 and article.flag1=0
Thisform.grid1.SetAll("dynamicforecolor", ;
"IIF(article.qut_stk>0 and article.flag1=0, RGB(255,255,255), RGB(0,0,0))", "Column")
Thisform.grid1.SetAll("dynamicbackcolor", ;
"IIF(article.qut_stk>0 and article.flag1=0, RGB(0,0,0), RGB(255,255,255))", "Column")
Endcase]
 
This is ture, because only the last record is set according to your condition of the dynamic backcolor.

The condition should be in the call to set the dynamic backcolor.

I gues you set the dymnamicbackcolor according to a cutom method on your grid.

Something like:

Thisform.grid1.SetAll("dynamicforecolor", ;
"IIF THISFORM.MySpecificFunction(), RGB(255,255,255), RGB(0,0,0))", "Column").

If you put this in the init of the grid the dynamicbackcolor is re-evaluated everytime you refresh the grid. So the DO CASE/ENDCASE should be in MySpecificFunction() or a cutom method like f.i. THISFORM.MySpecificFunction().

In your case the dynamic backcolor is reset everytime you skip a record. This can casue much slowing down if your have a large table.


HTH,
Weedz (Wietze Veld)
veld4663@exact.nl
The Netherlands

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
==========================================
Form level method .....

ThisForm.MyGridClr


WITH ThisForm

.cMyForeRGB = "RGB(0,0,0)"
.cMyBackRGB = "RGB(255,255,255)"

Do case
Case article.qut_stk=0 and article.qut_conf>0
.cMyForeRGB = "RGB(255,255,255)"
.cMyBackRGB = "RGB(145,72,72)"
Case article.qut_stk>0 and article.flag1=3
.cMyForeRGB = "RGB(255,255,255)"
.cMyBackRGB = "RGB(187,119,119)"
Case article.qut_stk>0 and article.flag1=2
.cMyForeRGB = "RGB(255,255,255)"
.cMyBackRGB = "RGB(255,102,102)"
Case article.qut_stk>0 and article.flag1=0
.cMyForeRGB = "RGB(255,255,255)"
.cMyBackRGB = "RGB(0,0,0)"
Endcase

EndWith

RETURN .t.
===========================================
InitEvent of the Form .....

Thisform.grid1.SetAll("DynamicForeColor", ;
IIF(ThisForm.MyGridClr(), ;
EVAL(ThisForm.cMyForeRGB),RGB(0,0,0), "Column")
Thisform.grid1.SetAll("DynamicBackColor", ;
IIF(ThisForm.MyGridClr(), ;
EVAL(ThisForm.cMyBackRGB),RGB(0,0,0), "Column")
===========================================
Hope this helps you

ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Ramani,

Just what I thought about. ;-)

Cheers,
Weedz (Wietze Veld)
veld4663@exact.nl
The Netherlands

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
Hi,
Many thanks for your reply,
I included ,I create the method and I affect the
appropriate code to the init form but I had an error message " verb of command not recognized ", so how can I correct this error?
Many many thanks, I very gratefull.

 
Iso of EVAL(ThisForm.cMyBackRGB) you could use &ThisForm.cMyBackRGB

HTH,

Weedz (Wietze Veld)
veld4663@exact.nl
The Netherlands

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
Hi,
Thanks for your reply
The error isn't applay but there isn't a color in 2nd grid!!!
 
Have you tried it for a single condition. If this doesn't work, you might want to fiddle around a bit with your conditions.

Just check if the debugger shows you the correct values...

Don't give up yet....just keep trying, that's what windows programming often is all about ;-)

HTH,
Weedz (Wietze Veld)
veld4663@exact.nl
The Netherlands

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
Hi,

try:

Local oMyVar
oMyVar = ThisForm.cMyBackRGB
&oMyVar

 
1. I hope you are using VFP6
2. If you have set the default values for the properties, cMyForeRGB and cMyBackRGB, you can set it as RGB(255,255,255), RGB(0,0,0) respectively
3. The codes you have put, is in the form2, I hope.
These codes work in my dummy created and so should work for you as well
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top