带有本机移动滚动条的数据网格中的空行上的mouseUp导致错误

时间:2014-08-12 11:07:29

标签: livecode

我使用原生卷轴显示大约700条记录的数据网格。当可见记录的数量很小(1-2)并且它们不覆盖数据网格矩形的整个高度时,那么当在数据网格中的空行上执行mouseUp时,我收到此错误:

在下午2:57:26执行

类型块:无法找到背景

对象:主

行:将mouseUp发送到字段"标签"组"行模板0003"小组" dgList" of group" dgListMask"组" DataGrid 1"卡"主"

提示:mouseUp

上面的行是卡片脚本中滚动条脚本的一部分,可以在不滚动DG时轻松点击行:

on mouseUp
   if not isScrolling then
      send mouseUp to field "Label" of group "Row Template 0003" of group "dgList" of group "dgListMask" of group "DataGrid 1" of card "main"
   end if
end mouseUp

要修复错误,我将其更改为:

on mouseUp
   if gCurrentIndex = empty then -- added this line in the hope that it will fix it but it does not
      exit to top -- added this line in the hope that it will fix it but it does not
   else -- added this line in the hope that it will fix it but it does not
      if not isScrolling then
         send mouseUp to field "Label" of group "Row Template 0003" of group "dgList" of group "dgListMask" of group "DataGrid 1" of card "main"
      end if
   end if
end mouseUp

但它并没有解决他的问题。

行模板标签中的代码是:

global gCurrentView,gCurrentLine,gCurrentIndex

on mouseUp
   put the text of me into fld "foneline" of cd "oneline"
   put the dgText of grp "DataGrid 1" into gCurrentView
   put the dgHilitedLines of grp "DataGrid 1" into gCurrentLine
   put the dgHilitedIndexes of grp "DataGrid 1" into gCurrentIndex
   lock screen for visual effect
   unlock screen with visual effect reveal right slow
   go cd "oneline"
end mouseUp

要复制错误,请按以下步骤操作:

  1. 打开堆栈

  2. 点击"我的选择"按钮

  3. 点击消息"抱歉......"

  4. 点击报价下方的灰色星号(仅选择1个引号)

  5. 点击"信息中心"按钮

  6. 点击"我的选择"按钮

  7. 点击引号

  8. 下面的淡黄色区域
  9. 错误窗口将显示

  10. 如果第一次没有显示错误则继续

    1. 点击淡黄色区域上方的文字数据

    2. 点击"整个选项"按钮

    3. 点击引号下方的淡黄色区域 - 这次错误肯定会出现。

    4. 上述步骤可能看起来很复杂,但只要看到此处的堆栈,就会非常简单:DG-empty row error.zip

      如何解决此错误?

2 个答案:

答案 0 :(得分:0)

不确定gCurrentIndex是否已在第二个代码块中声明为全局...

global gCurrentIndex
on mouseUp
   if gCurrentIndex = empty then -- added this line in the hope that it will fix it but it does not
      exit to top -- added this line in the hope that it will fix it but it does not
   else -- added this line in the hope that it will fix it but it does not
      if not isScrolling then
         send mouseUp to field "Label" of group "Row Template 0003" of group "dgList" of group "dgListMask" of group "DataGrid 1" of card "main"
      end if
   end if
end mouseUp

答案 1 :(得分:0)

解决方案是将此代码块添加到DG行模板的文本字段中,而不是添加到滚动条代码中:

  if gCurrentIndex = empty then
     exit to top
  else
     lock screen for visual effect
     unlock screen with visual effect reveal right slow 
     go cd "oneline"
  end if

重新这一行:

send mouseUp to field "Label" of group "Row Template 0003" of group "dgList" of group "dgListMask" of group "DataGrid 1" of card "main"

及其替代方案:

send mouseUp to field "Label"

我测试了滚动和点击行,有和没有这条线,没有区别,它的工作原理。我不记得我从哪里获得那条线,可能来自LC论坛上的某个人。我们的想法是确保在触摸行时滚动DG,它不会转到卡片上" oneline"。我现在一直在关注它是如何运作的。