Alan,
Would it not be easier to do an "SQL Select" on the stats table into a
separate cursor say "curStats" and then populate the grid with this "copy"
whenever you need to update the stats. That way you will be in control and
you can call a method "Refresh_curStats" whenever you see fit.

Dave Crozier


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Alan Bain
Sent: 04 February 2010 13:05
To: [email protected]
Subject: Problem with dynamicbackcolor in grid

I sent this last night but hasn't shown up yet.  Sorry if reposted.

Guys,

I am stuck.  I have run into a problem with   thisform.grid3.columns(1).
dynamicbackcolor. I have been working on this on and off for a month
trying various ways to get this working.

Let me see if I can explain this. I have two separate forms on the
desktop. The upper form is the record detail with some buttons that
call methods.  The fields are databound to the table but the field is
populated from the button with a replace command. In the lower form I
have a grid with 9 columns using several different colors to highlight
different stats of the record. This is a multiuser environment. I have
a datamanager for updates.

In the  button method that records the time stamp I issue a replace
<field> with time(). I keep getting update conflicts immediately upon
issuing the replace command if another user has changed the record
elsewhere.  The problem is that I don’t even get a chance to call the
datamanager tableupdate command.  When I step through the commands the
grids dynamicbackcolor function gets called immediately upon issuing
the replace command.. In the step degguer I see the record number
changing going through each record in the grid.

I have figured out that the dynamicbackcolor gets called immediately
when a replace command is used. In the dynamicbackcolor I have a UDF’s
that check a filed stat and colors the row appropriately.  I see that
in doing this am implicit tableupdate command is issued.  But i still
get update conflicts even if I issue a tableupdate command  one line
before the replace command and it returns .T.  If I set a flag to not
use the dynamicbackcolor (default.unitcolors = .f.) then I have no
problems.

I have the dynamicbackcolor in the init of the lower form containing
the grid.  I have tried putting the routine in the refresh thinking
that it wouldn’t get called until a refresh was issued. But that
didn't work either. I have googled dynamicbackcolor, setall, etc but
cannot find any information on when and how the dynamicbackcolor gets
called and how to fix or workaround this issue.

I sure would appreciate any of you experts enlightening me on this issue.
Thanks!
Alan

Snippet of code from lower form init:

thisform.gncurrrec = recno()
*distinguish between txf call by color in first column
IF default.showtxf
thisform.grid3.columns(1).dynamicbackcolor = ;
"iif(dispatch.txf,rgb(255,185,255),rgb(255,255,255))"
ENDIF

IF default.unitcolors
*thisform.grid3.columns(2).dynamicbackcolor = ;
"iif(dispatch.txf,rgb(255,130,255),rgb(255,255,255))"
thisform.grid3.columns(1).dynamicbackcolor = "thisform.isprinted()"
thisform.grid3.columns(5).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(6).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(7).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(8).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(9).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(10).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(11).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(12).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(13).dynamicbackcolor = "thisform.unitckcolor()"
thisform.grid3.columns(14).dynamicbackcolor = "thisform.unitckcolor()"
ENDIF

•Column 3,4 is grid highlighter rows
Thisform.grid3.columns(3).Dynamicbackcolor =  ;
"IIF(recno() = thisform.gncurrrec, RGB(192,248,254) ,RGB(255,255,255))"
Thisform.grid3.columns(4).Dynamicbackcolor =  ;
"IIF(recno() = thisform.gncurrrec, RGB(192,248,254) ,RGB(255,255,255))"


UDF method:

Parameter nval
nval = dispatch.stat
*OAPP.EXLOG('~GET_GRID~ start unitcolor check. NVAL parm is ' +
TRANSFORM(nval) + ' Recno is ' + TRANSFORM(RECNO()))
Do case
Case nval = 0
Return(rgb(192,192,192))
Case nval = 1
Return(rgb(245,250,165))
Case nval = 2
Return(rgb(225,238,185))
Case nval = 3
Return(rgb(133,249,4))
Case nval = 4
Return(rgb(252,210,154))
Case nval = 5
Return(rgb(189,225,201))
Case nval = 6
Return(rgb(152,249,254))
Case nval = 7
Return(rgb(163,201,243))
Case nval = 8
*Return(rgb(250,156,196))
return(rgb(255,197,221))
Case nval = 9
Return(rgb(224,200,167))
Case nval = 10
*Return(rgb(255,136,202))
return(rgb(255,255,255))
Otherwise
Return(rgb(192,192,192))
Endcase

Return(rgb(192,192,192))

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/88a07721fa2742328cfda213babc9...@develop
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to