Code: Select all
on mouseUP
put fld "comments" into theDataA["comments"]
end mouseUp
Code: Select all
local vLine
on mouseDown
   put the dgIndex of me into vLine
end mouseDown
on FillInData pDataArray
set the text of field "Label" of me to pDataArray["label 2"]
set the text of field "name" of me to pDataArray["name"]
set the text of field "commentField" of me to pDataArray["commentField"]
set the text of field "order" of me to pDataArray["order"]
set the text of field "total" of me to pDataArray["total"]
end FillInData
command EditValue
switch the short name of the target
case "Label"
EditFieldText the long id of field "Label" of me, the dgIndex of me,"label 2"
break
case "name"
EditFieldText the long id of field "name" of me, the dgIndex of me,"label 3"
break
case "commentField"
EditFieldText the long id of field "commentField" of me, the dgIndex of me,"label 4"
break
case "order"
EditFieldText the long id of field "order" of me, the dgIndex of me,"label 5"
break
case "total"
EditFieldText the long id of field "total" of me, the dgIndex of me,"label 8"
break
end switch
end EditValue
on mouseDoubleUp pMouseBtnNum
    if pMouseBtnNum is 1 then
        if (word 1 of the target is "field") then
            if the dgProps["allow editing"] of the dgControl of me then
                EditValue
                exit mouseDoubleUp
            end if
        end if
    end if
    
    pass mouseDoubleUp
end mouseDoubleUp
on mouseUp pTheButton
if (pTheButton is 1) then
switch the short name of the target
case "Background"
break
//This is where I add the comments to the field but they are not retained when leaving the card
//I assume this data from "it" needs to be put into the array, but I cannot seem to figure this out...
//maybe I am just wrong all together in my thinking
case "comments"
   ask "Enter any comments for your order" titled "Special Instructions"
   put it into fld "commentField" of me
break
case "delete"
send "deleteindex vLine" to grp "DataGrid" in 1
break
end switch
end if
end mouseUp
on LayoutControl pControlRect
set the rect of graphic "Background" of me to pControlRect
end LayoutControl
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
-- Utility
getprop dgDataControl
    -- Required by library so that it can locate your control.
    return the long id of me
end dgDataControl

