在两个列表之间移动可编辑项目?

爵士先生

无法发布图片,如果需要请通知我

感谢您的任何帮助!这样做的目的是能够编辑一张卡上的列表并将其移动到另一张卡上的列表。我还试图使该项目也包括可编辑的时间,可编辑的描述和对象的图片。所有这些都没有显示在列表中,只是标题。如果我需要解释更多,请告诉我。我对此很陌生。

Card Edit: 
on preopencard   
   ## Populate the fields
   put empty into field "title 2"
   put empty into field "description 2"
   put the long date into field "date 2"

   ## Check which task we want to edit 
   ## using the custom property set on this card when we selected a task from the list
   put the cTaskID2 of me into tTaskID2

   ## Get the current details of the task
   put taskDetail2(tTaskID2, "title 2") into tTitle2
   put taskDetail2(tTaskID2, "description 2") into tDescription2
   put taskDetail2(tTaskID2, "completed 2") into tCompleted2
   ## And display then in the relevant fields
   put tTitle2 into field "title 2"
   put tDescription2 into field "description 2"

   ## Set the label of the completed button to allow you to toggle the state
   if tCompleted2 then
      set the label of button "completed 2" to "mark as incomplete"
   else
      set the label of button "completed 2" to "mark as complete"
   end if
end preopencard

on closeCard
   ## Check which task we want to update 
   ## using the custom property set on this card when we selected a task from the list
   put the cTaskID2 of me into tTaskID2

   if tTaskID2 is not empty then
      ## Update the task data in the cTaskData custom property of the stack
      updateTask2 tTaskID2, field "title 2", field "description 2"

      ## Save the task data out to file, ensures our file always refelects the current state
     saveTaskData
   end if
end closeCard



Stack script: (The ones with 2 are for this card) 


on preOpenStack
   ## Read the task list in from file
   readTaskData
end preOpenStack

on addTask pTitle, pDescription
   ## Add a task to the custom property of the stack that is storing the task list
   ## Remember you cannot update a part of a custom property
   ## It must be set in its entirety

  put the cTaskData of me into tTaskDetails
  put pTitle & tab & pDescription & tab & "false" & return after tTaskDetails
  set the cTaskData of me to tTaskDetails
end addTask

on addTask2 pTitle2, pDescription2
   ## Add a task to the custom property of the stack that is storing the task list
   ## Remember you cannot update a part of a custom property
   ## It must be set in its entirety

  put the cTaskData2 of me into tTaskDetails2
  put pTitle2 & tab & pDescription2 & tab & "false" & return after tTaskDetails2
  set the cTaskData2 of me to tTaskDetails2
end addTask2

on updateTask pLineNumber, pTitle, pDescription, pCompleted, 
   ## Update the details for  the given task in the custom property of the stack thast is storing the task list

   put the cTaskData of me into tTaskDetails
   set the itemDel to tab

   if pTitle <> empty then put pTitle into item 1 of line pLineNumber of tTaskDetails
   if pDescription <> empty then put pDescription into item 2 of line pLineNumber of tTaskDetails
   if pCompleted <> empty then put pCompleted into item 3 of line pLineNumber of tTaskDetails
   set the cTaskData of me to tTaskDetails
end updateTask

on updateTask2 pLineNumber2, pTitle2, pDescription2, pCompleted2, 
   ## Update the details for  the given task in the custom property of the stack thast is storing the task list

   put the cTaskData2 of me into tTaskDetails2
   set the itemDel to tab

   if pTitle2 <> empty then put pTitle into item 1 of line pLineNumber2 of tTaskDetails2
   if pDescription2 <> empty then put pDescription2 into item 2 of line pLineNumber2 of tTaskDetails2
   if pCompleted2 <> empty then put pCompleted2 into item 3 of line pLineNumber2 of tTaskDetails2
   set the cTaskData2 of me to tTaskDetails2
end updateTask2

on deleteTask pLineNumber
   ## Delete the given task from the custom property of the stack
   ## Remember the task id corresponds to the line number of the task in the custom property
   put the cTaskData of me into tTaskDetails
   delete line pLineNumber of tTaskDetails
   set the cTaskData of me to tTaskDetails
end deleteTask

on deleteTask2 pLineNumber2
   ## Delete the given task from the custom property of the stack
   ## Remember the task id corresponds to the line number of the task in the custom property
   put the cTaskData2 of me into tTaskDetails2
   delete line pLineNumber2 of tTaskDetails2
   set the cTaskData2 of me to tTaskDetails2
end deleteTask2

on deleteAllTasks
   ## Delete all tasks
   set the cTaskData of me to empty
end deleteAllTasks

on deleteAllTasks2
   ## Delete all tasks
   set the cTaskData2 of me to empty
end deleteAllTasks2

function taskDetail pLineNumber, pDetailType
   ## Get the specified detail of the specified task
   ## Remember each line of the custom property represents a task
   ## and the task details are tab separated

  put the cTaskData of me into tTaskDetails
  set the itemDel to tab
  switch pDetailType
    case "title"
      put item 1 of line pLineNumber of tTaskDetails into tDetail
      break
    case "description"
      put item 2 of line pLineNumber of tTaskDetails into tDetail
      break
    case "completed"
      put item 3 of line pLineNumber of tTaskDetails into tDetail
      break
  end switch
  return tDetail
end taskDetail

function taskDetail2 pLineNumber2, pDetailType2
   ## Get the specified detail of the specified task
   ## Remember each line of the custom property represents a task
   ## and the task details are tab separated

  put the cTaskData2 of me into tTaskDetails2
  set the itemDel to tab
  switch pDetailType2
    case "title2"
      put item 1 of line pLineNumber2 of tTaskDetails2 into tDetail2
      break
    case "description2"
      put item 2 of line pLineNumber2 of tTaskDetails2 into tDetail2
      break
    case "completed2"
      put item 3 of line pLineNumber2 of tTaskDetails2 into tDetail2
      break
  end switch
  return tDetail2
end taskDetail2

function taskCount
   ## Find out how many tasks are currently in the list
   return the number of lines in the cTaskData of me
end taskCount

function taskCount2
   ## Find out how many tasks are currently in the list
   return the number of lines in the cTaskData2 of me
end taskCount2

on saveTaskData
   ## Build the path to the file we want to store the data in
   ## In this case we want to use the "documents" folder
   ## Save the task list out to file
   put specialFolderPath("documents") & "/tasklist.txt" into tSavePath
   put the cTaskData of me into url ("file:" & tSavePath)
end saveTaskData

on readTaskData
   ## Read the task list in from file
   put specialFolderPath("documents") & "/tasklist.txt" into tSavePath
   if there is a file tSavePath then
      put url ("file:" & tSavePath) into tTaskDetails
   end if

   ## Set the custom property of the stack to the contents of the file
   set the cTaskData of me to tTaskDetails
end readTaskData



List on card:

on mouseUp
   ## Work out which task has been selected
   ## The taskID corresponds to the line number in the list
   put word 2 of the clickline into tTaskID2
   showTaskDetails2 tTaskID2
end mouseUp

on showTaskDetails2 tTaskID2
   ## Set a custom property on the task editor card
   ## This tells it which task has been selected so the correct details can be shown
   set the cTaskID2 of card "edit 2" to tTaskID2
   go to card "edit 2"
end showTaskDetails2

这是Livecode

标记

我不清楚,为什么要在属性中保存那么多数据。数据放入字段后,您可以将其保存在该字段中。当您需要将数据从一张卡上的字段移动到另一张卡上的字段时,可以直接执行此操作。例如,假设您要将卡1的“标题”和“描述”字段的内容复制到卡2的相同字段中。

// this handler is in the card script of card 2
on preOpenCard
  put fld "Title" of cd 1 into fld "Title"
  put fld "Description" of cd 1 into fld "Description"
end preOpenCard

这就是您所需要的。在这种特殊情况下,不需要自定义属性。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

AngularJS在两个选择列表之间移动项目

来自分类Dev

在Android活动中的两个列表视图之间移动项目?

来自分类Dev

在两个哈希表之间移动项目

来自分类Dev

随机在两个列表之间划分项目

来自分类Dev

计算列表中两个项目之间的距离

来自分类Dev

在两个div之间移动块

来自分类Dev

是否有一个列表来比较两个列表之间的项目属性?

来自分类Dev

提取列表中两个值之间的项目列表-Prolog

来自分类Dev

两个项目之间的参考

来自分类Dev

减少两个项目之间的重复

来自分类Dev

如何将两个可编辑和可更新的DataGridView绑定到一个列表和子列表?

来自分类Dev

在两个列表中搜索项目

来自分类Dev

迭代两个列表并组合项目

来自分类Dev

得到两个列表之间的区别?

来自分类Dev

发现两个列表之间的差异

来自分类Dev

在两个列表片段之间导航

来自分类Dev

两个TimeSpans之间的时间列表

来自分类Dev

两个日期之间的年份列表

来自分类Dev

Linq在两个列表之间搜索

来自分类Dev

两个列表之间的异类组合

来自分类Dev

找到两个列表之间的区别

来自分类Dev

列表之间的两个公共元素

来自分类Dev

在gwt中创建带有两个列表框和一个可编辑文本字段的单元格表

来自分类Dev

生成器,可确保列表中两个项目之间的最小距离

来自分类Dev

在列表视图的两个项目之间添加垂直线(“链接”)

来自分类Dev

两个项目之间的跨项目引用

来自分类Dev

两个项目之间的跨项目引用

来自分类Dev

jQuery-具有两个不可编辑值的文本框

来自分类Dev

jQuery-文本框具有两个不可编辑的值