As you scroll around and check or uncheck items, if you scroll to to see other items, those items have been changed as well.
It is happening on 2 datagrid forms.... Here is my code for the row behavior on one of the datagrids.
Code: Select all
on CalculateFormattedHeight pDataArray
if pDataArray["expanded"] then
return 99
else
return 57
end if
end CalculateFormattedHeight
on FillInData pDataArray
set the text of field "firstname" of me to pDataArray["label 1"]
set the text of field "label" of me to pDataArray["label 2"]
set the label of btn "contact_email" of me to pDataArray["label 3"]
set the label of btn "webname" of me to pDataArray["label 4"]
put pDataArray["label 5"] into field "text_home" of me
set the label of btn "button_cell" of me to pDataArray["label 6"]
put pDataArray["label 7"] into field "text_cell" of me
set the text of field "relationship" of me to pDataArray["label 8"]
set the text of field "company" of me to pDataArray["label 9"]
set the text of field "street" of me to pDataArray["label 10"]
set the text of field "city" of me to pDataArray["label 11"]
set the text of field "state" of me to pDataArray["label 12"]
set the text of field "zip" of me to pDataArray["label 13"]
if pDataArray["label 14"] is "yes" then
set the hilite of button "OK" of me to true
else
set the hilite of button "OK" of me to false
end if
if pDataArray["expanded"] is "" then
put false into pDataArray["expanded"]
else
end if
set the hilite of button "change" of me to false
set the visible of field "text_home" of me to false
set the visible of field "text_cell" of me to false
set the visible of graphic "ArrowExpanded" of me to pDataArray["expanded"]
set the visible of graphic "arrowcontracted" of me to not pDataArray["expanded"]
set the visible of btn "contact_email" of me to pDataArray["expanded"]
set the visible of btn "webname" of me to pDataArray["expanded"]
set the visible of btn "button_cell" of me to pDataArray["expanded"]
set the visible of field "relationship" of me to pDataArray["expanded"]
set the visible of field "company" of me to pDataArray["expanded"]
set the visible of field "street" of me to pDataArray["expanded"]
set the visible of field "city" of me to pDataArray["expanded"]
set the visible of field "state" of me to pDataArray["expanded"]
set the visible of field "zip" of me to pDataArray["expanded"]
end FillInData
on LayoutControl pControlRect
local theFieldRect
put the height of this stack into tstackheight
if the environment is "mobile" and tstackheight >700 then
set the width of graphic "arrowcontracted" of me to 56
set the height of graphic "arrowcontracted" of me to 60
set the width of graphic "arrowexpanded" of me to 60
set the height of graphic "arrowexpanded" of me to 56
else if the environment is "mobile" and tstackheight <=700 then
set the width of graphic "arrowcontracted" of me to 30
set the height of graphic "arrowcontracted" of me to 36
set the width of graphic "arrowexpanded" of me to 36
set the height of graphic "arrowexpanded" of me to 20
else
set the width of graphic "arrowcontracted" of me to 36
set the height of graphic "arrowcontracted" of me to 42
set the width of graphic "arrowexpanded" of me to 42
set the height of graphic "arrowexpanded" of me to 36
end if
put the width of scrollbar "dgScrollbar" of group "dataGrid 22" into scrollbarwidth
put the width of this stack into tstackwidth
put (tstackwidth*.95-scrollbarwidth)*.97 into tavailable
if the environment is "mobile" and tstackheight >700 then
set the textsize of field "firstname" of me to 44
set the width of field "firstname" of me to 100
set the height of field "firstname" of me to 28
set the textsize of field "label" of me to 18
set the width of field "label" of me to 166
set the height of field "label" of me to 32
set the textsize of button "contact_email" of me to 18
set the width of button "contact_email" of me to 278
set the height of button "contact_email" of me to 36
set the textsize of field "street" of me to 18
set the width of field "street" of me to 282
set the height of field "street" of me to 32
set the textsize of field "city" of me to 18
set the width of field "street" of me to 212
set the height of field "street" of me to 32
set the textsize of field "state" of me to 18
set the width of field "state" of me to 72
set the height of field "state"of me to 32
set the textsize of field "zip" of me to 18
set the width of field "zip" of me to 230
set the height of field "zip" of me to 32
set the textsize of field "relationship" of me to 18
set the width of field "relationship" of me to 127
set the height of field "relationship" of me to 44
set the textsize of field "company" of me to 18
set the width of field "company" of me to 161
set the height of field "company" of me to 32
set the textsize of button "webname" of me to 18
set the width of button "webname" of me to 168
set the height of button "webname" of me to 36
set the textsize of button "button_cell" of me to 18
set the width of button "button_cell" of me to 168
set the height of button "button_cell" of me to 36
set the textsize of button "OK" of me to 18
set the textsize of button "change" of me to 18
else if the environment is "mobile" and tstackheight <=700 then
set the textsize of field "firstname" of me to 12
set the width of field "firstname" of me to 100
set the height of field "firstname" of me to 28
set the textsize of field "label" of me to 12
set the width of field "label" of me to 166
set the height of field "label" of me to 32
set the textsize of button "contact_email" of me to 12
set the width of button "contact_email" of me to tavailable*.50
set the height of button "contact_email" of me to 36
set the textsize of field "street" of me to 12
set the width of field "street" of me to tavailable*.50
set the height of field "street" of me to 32
set the textsize of field "city" of me to 12
set the width of field "city" of me to tavailable*.22
set the height of field "city" of me to 32
set the textsize of field "state" of me to 12
set the width of field "state" of me to tavailable*.10
set the height of field "state"of me to 32
set the textsize of field "zip" of me to 12
set the width of field "zip" of me to tavailable*.18
set the height of field "zip" of me to 32
set the textsize of field "relationship" of me to 12
set the width of field "relationship" of me to tavailable*.25
set the height of field "relationship" of me to 44
set the textsize of field "company" of me to 12
set the width of field "company" of me to tavailable*.75
set the height of field "company" of me to 32
set the textsize of button "webname" of me to 12
set the width of button "webname" of me to tavailable*.35
set the height of button "webname" of me to 36
set the textsize of button "button_cell" of me to 12
set the width of button "button_cell" of me to tavailable*.35
set the height of button "button_cell" of me to 36
set the textsize of button "OK" of me to 12
set the textsize of button "change" of me to 12
else
set the textsize of field "firstname" of me to 18
set the width of field "firstname" of me to 100
set the height of field "firstname" of me to 28
set the textsize of field "label" of me to 18
set the width of field "label" of me to 166
set the height of field "label" of me to 32
set the textsize of button "contact_email" of me to 18
set the width of button "contact_email" of me to 278
set the height of button "contact_email" of me to 36
set the textsize of field "street" of me to 18
set the width of field "street" of me to 282
set the height of field "street" of me to 32
set the textsize of field "city" of me to 18
set the width of field "street" of me to 212
set the height of field "street" of me to 32
set the textsize of field "state" of me to 18
set the width of field "state" of me to 72
set the height of field "state"of me to 32
set the textsize of field "zip" of me to 18
set the width of field "zip" of me to 230
set the height of field "zip" of me to 32
set the textsize of field "relationship" of me to 18
set the width of field "relationship" of me to 127
set the height of field "relationship" of me to 44
set the textsize of field "company" of me to 18
set the width of field "company" of me to 161
set the height of field "company" of me to 32
set the textsize of button "webname" of me to 18
set the width of button "webname" of me to 168
set the height of button "webname" of me to 36
set the textsize of button "button_cell" of me to 18
set the width of button "button_cell" of me to 168
set the height of button "button_cell" of me to 36
set the textsize of button "OK" of me to 18
set the textsize of button "change" of me to 18
end if
put item 1 of pControlRect into ttry
put the left of graphic "ArrowExpanded" of me - 6 into item 1 of theFieldRect
put the top of field "firstname" of me into item 2 of theFieldRect
set the left of field "firstname" of me to ttry + 55
put the formattedwidth of field "firstname" of me into tusewidth
set the left of field "Label" of me to ttry + 55 + tusewidth + 3
set the top of button "contact_email" of me to the bottom of field "firstname" of me + 25
set the left of button "contact_email" of me to ttry + 20
set the top of button "OK" of me to the top of field "Label" of me
put the width of this stack into tstackwidth
set the left of button "OK" of me to tstackwidth*.55
set the top of button "change" of me to the bottom of button "OK" of me
set the left of button "change" of me to tstackwidth*.55
set the bottom of button "webname" of me to the bottom of button "contact_email" of me
set the left of button "webname" of me to the right of button "contact_email" of me + 10
set the top of field "street" of me to the bottom of button "contact_email" of me + 10
set the left of field "street" of me to ttry +10
set the left of button "button_cell" of me to the left of button "webname" of me
set the bottom of button "button_cell" of me to the bottom of field "street" of me
put the right of button "button_cell" of me + 10 into tright
put tright into item 3 of theFieldRect
set the left of field "city" of me to ttry + 10
set the top of field "city" of me to the bottom of field "street" of me
put the formattedwidth of field "city" of me into tusewidth2
set the bottom of field "state" of me to the bottom of field "city" of me
set the bottom of field "zip" of me to the bottom of field "city" of me
set the left of field "state" of me to ttry + 10 + tusewidth2 + 5
set the left of field "zip" of me to the right of field "state" of me + 5
set the top of field "relationship" of me to the bottom of field "state" of me + 10
set the left of field "relationship" of me to ttry + 10
set the bottom of field "company" of me to the bottom of field "relationship" of me
set the left of field "company" of me to the right of field "relationship" of me + 10
put the bottom of field "relationship" of me into tbottom
put tbottom into item 4 of theFieldRect
put the label of button "contact_email" of me into tone
if tone is "contact_email" or tone is "" then
set the vis of button "contact_email" of me to false
end if
put the label of button "webname" of me into ttwo
if ttwo is "webname" or ttwo is "" then
set the vis of button "webname" of me to false
end if
put the label of button "button_cell" of me into tthree
if tthree is "button_cell" or tthree is "" then
set the vis of button "button_cell" of me to false
end if
if the visible of field "relationship" of me then
put the bottom of field "relationship" of me + 10 into item 4 of theFieldRect
else
put the bottom of field "firstName" of me + 28 into item 4 of theFieldRect
end if
set the rect of graphic "Background" of me to theFieldRect
end LayoutControl
on ResetData
-- Sent when data is being emptied because the control is no longer being used to display data
set the text of field "Label" of me to empty
end ResetData
on PreFillInData
-- Sent right before new data is going to replace existing data in the control
end PreFillInData
setprop dgHilite pBoolean
-- This custom property is set when the highlight of your custom template has
-- changed. By default the "Background" graphic will be highlighted for you.
-- You only add script here if you want to further customize the highlight.
-- Example:
set the dgProp["hilited text color"] of the dgControl of me to "black"
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
-- Required by library so that it can locate your control.
return the long ID of me
end dgDataControl
on mouseDoubleUp pMouseBtnNum
local theKey
-- Example of how to edit the contents of a field.
-- By passing the index of the record associated with copy of this template being displayed and
-- a key (array key) the data grid will automatically save the changes the user
-- makes and refresh the UI by calling FillInData and resizeControl.
if pMouseBtnNum is 1 then
if the dgProps["allow editing"] of the dgControl of me then
switch the short name of the target
case "Label"
put "Label 1" into theKey
EditFieldText the long ID of the target, the dgIndex of me, theKey
break
end switch
end if
end if
pass mouseDoubleUp
end mouseDoubleUp
on mouseUp pMouseBtnNum
if pMouseBtnNum is 1 then
switch the short name of the target
case "ArrowExpanded"
case "ArrowContracted"
## Update internal data
SetDataOfIndex the dgIndex of me, "expanded", the short name of the target is "ArrowContracted"
## Redraw so LayoutControl and FillInData can update UI
RefreshIndex the dgIndex of me
break
end switch
end if
end mouseUp