Need Data Grid help
pink
nabble at mad.pink
Sun May 5 15:45:31 EDT 2019
Below is the script for a data grid and the stack script.
The data grid times certain jobs, so if you press one, it switched to timing
that job.
The problem is, when I set the dgData for the grid, the rows are blank up to
the row that I press, and none of the changed data appears. However, if I
just set it again in a different action it shows up correctly. That is, the
data doesn't seem to set correctly as part of my activateJob handler. If I
then try to set it again in a different mouseUp handler, everything shows up
correctly.
-------------------------
Data Grid Script:
on FillInData pData
local tJob, tTime, tTemp, tHour, tMin
put pData["jobno"] & space into tJob
put pData["client"] & space after tJob
put "-" && pData["jobname"] after tJob
if pData["timer"] is true then
set the backgroundColor of graphic "Status" of me to "green"
else
set the backgroundColor of graphic "Status" of me to "red"
end if
put pData["time"] into tTemp
put trunc(tTemp/60)into tHour
if tHour < 1 or tHour is empty then put 0 into tHour
put tTemp - (tHour*60) into tMin
if tMin < 1 or tMin is empty then put 0 into tMin
put tHour & "h" && tMin & "m" into tTime
put me into tX
set the text of field "jobInfo" of me to tJob
set the text of field "taskCode" of me to pData["taskcode"]
set the text of field "currentTime" of me to tTime
end FillInData
setprop dgHilite pBoolean
if pBoolean then
set the foregroundColor of me to the dgProp["hilited text color"] of the
dgControl of me
else
set the foregroundColor of me to empty
end if
end dgHilite
getprop dgDataControl
return the long ID of me
end dgDataControl
on mouseUp
local tNum
put char -5 to -2 of word 5 of the long name of the target into tNum
put (tNum * 1) into tNum
switch the short name of the target
case "Edit"
editJob tNum
break
case "Adjust"
adjustJob tNum
break
case "Status"
activateJob tNum
break
end switch
end mouseUp
----
Stack Script
local sTimer
command activateJob pNum
put "activate" into sTimer["settings"]["action"]
if sTimer["data"][pNum]["timer"] then
onEndTimer pNum
else
onStartTimer pNum
end if
set the dgData of group "jobTimers" to sTimer["data"]
end activateJob
command onStartTimer pNum
repeat for each key tK in sTimer["data"]
if sTimer["data"][tK]["timer"] is true then
onEndTimer tK
end if
put false into sTimer["data"][tk]["timer"]
put empty into sTimer["data"][tk]["starttime"]
end repeat
put true into sTimer["data"][pNum]["timer"]
put the seconds into sTimer["data"][pNum]["starttime"]
end onStartTimer
command onEndTimer pNum
local tCurrent
put the seconds into tCurrent
subtract sTimer["data"][pNum]["starttime"] from tCurrent
put round(tCurrent/60) into tCurrent
add tCurrent to sTimer["data"][pNum]["time"]
put false into sTimer["data"][pNum]["timer"]
put empty into sTimer["data"][pNum]["starttime"]
end onEndTimer
-----
---
Greg (pink) Miller
mad, pink and dangerous to code
--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
More information about the use-livecode
mailing list