Datagrid 如何以编程方式编辑livecode数据网格中任意行中的字段?

Datagrid 如何以编程方式编辑livecode数据网格中任意行中的字段?,datagrid,livecode,Datagrid,Livecode,我正在做一个LiveCode项目,它显示一个带有DataGrid表的模式 如果用户选择DataGrid中的一个或多个行并单击OK按钮,则所选行将复制到另一个堆栈中的另一个DataGrid表中 我想在另一个堆栈中复制的第一行中打开一个编辑字段 我已经找到了EditFieldText命令,但还不能确定作为第一个参数(pField)提供什么 我假设其他参数(pIndex和pKey)分别是DataGrid行索引和列名 这是“我的确定”按钮中的代码: on mouseUp lock screen

我正在做一个LiveCode项目,它显示一个带有DataGrid表的模式

如果用户选择DataGrid中的一个或多个行并单击OK按钮,则所选行将复制到另一个堆栈中的另一个DataGrid表中

我想在另一个堆栈中复制的第一行中打开一个编辑字段

我已经找到了EditFieldText命令,但还不能确定作为第一个参数(pField)提供什么

我假设其他参数(pIndex和pKey)分别是DataGrid行索引和列名

这是“我的确定”按钮中的代码:

on mouseUp
   lock screen
   put the dgHiLitedLines of group selectComponentGrid into rowNumbers
   put the dgData of group selectComponentGrid into rows
   put true into firstTime
   repeat for each item rowNumber in rowNumbers
      put rows[rowNumber] into row 
      dispatch "AddData" to group bomGrid of card inventoryItem of stack inventory with row
      if firstTime is true then
         # Set focus to this row's quantity field.
         put "quantity" into colName
         put the result into lineNo -- the result contains the index of the new row
         send "EditCellOfIndex colName lineNo" to group bomGrid on card "inventoryItem" of stack "inventory"
         # At this point the result contains "no control exists for index column"
         put false into firstTime
      end if
      #end if
   end repeat
   unlock screen
   close this stack
end mouseUp
我花了几个小时阅读LiveCode文档和搜索。我找到了很多文章,但没有解释如何真正做到这一点

我正在Mac OS X 10.11.6上使用LiveCode 9.0.0-dp-4 | Build 15003社区版

编辑2017-01-17 13:23: 我找到了editCellFindex命令,根据找到的各种示例修改了代码以使用它,但也没有成功。 我已经更新了上面的代码以反映我所做的更改。

这都是关于语法的(我仍然习惯于使用LiveCode语法)。
我对EditCellFindex消息使用了错误的语法

我还需要将发送消息移出循环,将行添加到另一个DataGrid,因为下一次添加将关闭phantom编辑字段

感谢在LiveCode论坛上发布的语法捕获的sritcp。 以下是功能代码:

on mouseUp
   lock screen
   put empty into lineNo
   put the dgHiLitedLines of group selectComponentGrid into rowNumbers
   put the dgData of group selectComponentGrid into rows
   repeat for each item rowNumber in rowNumbers
      put rows[rowNumber] into row
      Dispatch "AddData" to group bomGrid of card inventoryItem of stack inventory with row
      if lineNo is empty then
         put the result into lineNo
      end if
   end repeat
   if lineNo is not empty then
      # Set focus to the first new row's quantity field.
      dispatch "EditCellOfIndex" \
            to group bomGrid on card "inventoryItem" of stack "inventory" \
            with "quantity", lineNo
   end if
   unlock screen
   close this stack
end mouseUp