以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  剪切、粘贴问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=108405)

--  作者:lzzhx
--  发布时间:2017/10/22 10:18:00
--  剪切、粘贴问题
功能区的“剪贴”、“粘贴”和快捷菜单中的“剪贴”、“粘贴”用的系统命令是一样的,但在实际操作中,快捷菜单中的“剪贴”、“粘贴”一点问题也没有,但功能区的“剪贴”、“粘贴”有时候会出现莫名其妙的问题,如在单元格处于编辑状态时,选择部分内容,点击功能区“剪切”按钮,会将单元格内容全部剪切,但用快捷菜单的“剪切”,就没有这个问题。
以上问题是在新打开一个项目时就存在。

在我的一个系统中,还存在下面的问题:

当选定一个单元格,点击功能区或快捷菜单的“剪切”按钮,会弹出运行错误\'未设置对象变量或with块变量‘,提示菜单中不存在名为”常用工具”的项目和菜单中不存在名为“内置聊天”的项目。

功能区和快捷菜单的“剪切”按钮的命令代码都是  Syscmd.Edit.Cut(),为什么执行结果会不同,有什么地方需要注意?会有什么全局事件会影响到这个命令的执行,以致于弹出错误对话框?请老师看看  
[此贴子已经被作者于2017/10/22 10:21:01编辑过]

--  作者:有点甜
--  发布时间:2017/10/22 18:10:00
--  

1、编辑状态的【剪切】和功能区的剪切不是同样的代码。你看到的那个,不是快捷菜单,是编辑框自带的。

 

2、自行调试 http://www.foxtable.com/webhelp/scr/1485.htm

 


--  作者:lzzhx
--  发布时间:2017/10/23 7:56:00
--  
只有Syscmd.Edit.Cut()一名代码,如何调试
--  作者:有点甜
--  发布时间:2017/10/23 8:37:00
--  
以下是引用lzzhx在2017/10/23 7:56:00的发言:
只有Syscmd.Edit.Cut()一名代码,如何调试

 

1、代码本身是没有问题的,这个代码不可能报错;

 

2、提示不存在某某菜单,是因为你哪里调用引用了菜单,但菜单不存在;你可以输出所有代码,搜索对应关键字,看哪里写了。


--  作者:lzzhx
--  发布时间:2017/10/23 8:49:00
--  
我就是按上面你说的做了,这2个菜单有,调用的时候也没有问题,其它地方也没有出现再调用的地方,就是不知为什么要出现这个错误,而且是不断的弹出错误,都停不下来
--  作者:有点甜
--  发布时间:2017/10/23 10:05:00
--  

输出所有代码 http://www.foxtable.com/webhelp/scr/1987.htm

 

搜索关键字,看在什么事件写了代码。


--  作者:lzzhx
--  发布时间:2017/10/23 11:22:00
--  
只是在菜单的系统事件_SystemIdle 中有下面的代码,我没有找出问题所在,请老师看看



\'----------------------------------------------------------------------------------------------------
Static OpenQQ As RibbonMenu.Button
Static LastTime As Date
If OpenQQ Is Nothing Then
    OpenQQ = ConfigBar.Items("内置聊天")
End If
Dim txt As String
If QQClient.Ready
    ConfigBar.Items("内置聊天").SmallImage = GetImage("online.ico")
    If QQClient.UnreadCount > 0 Then
        txt = "(" & QQClient.UnreadCount & "条)"
    End If
Else
    ConfigBar.Items("内置聊天").SmallImage = GetImage("offline.ico")
End If
If OpenQQ.Text <> txt Then
    OpenQQ.Text = txt
End If
If Forms("桌面导航").opened = True Then
    Forms("桌面导航").Controls("TopicBar1").Pages("即时通讯").Links("即时通讯").text = "  即时通讯  " & txt
End If
Dim ntp As timeSpan = Date.Now - LastTime
If ntp.TotalSeconds >= 1 Then
    LastTime = Date.Now
    If OpenQQ.Text > "" Then
        If OpenQQ.ForeColor = Color.Red Then
            OpenQQ.ForeColor = Color.Transparent
        Else
            OpenQQ.ForeColor = Color.Red
        End If
        If Forms("桌面导航").opened = True Then
            If QQClient.Ready = True Then
                If Forms("桌面导航").Controls("TopicBar1").Pages("即时通讯").Links("即时通讯").ImageFile = "online.ico"
                    Forms("桌面导航").Controls("TopicBar1").Pages("即时通讯").Links("即时通讯").ImageFile = "offline.ico"
                Else
                    Forms("桌面导航").Controls("TopicBar1").Pages("即时通讯").Links("即时通讯").ImageFile = "online.ico"
                End If
            Else
                Forms("桌面导航").Controls("TopicBar1").Pages("即时通讯").Links("即时通讯").ImageFile = "offline.ico"
            End If
        End If
    End If
    If Forms("桌面导航").opened = True Then
        If Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("今天生日员工").text.trim(" ") <> Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("今天生日员工").Name.trim(" ")  Then
            If Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("今天生日员工").ImageFile = "生日.ico" Then
                Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("今天生日员工").ImageFile = "生日1.ico"
            Else
                Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("今天生日员工").ImageFile = "生日.ico"
            End If
        Else
            Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("今天生日员工").ImageFile = "生日1.ico"
        End If
        If Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本周生日员工").text.trim(" ") <> Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本周生日员工").Name.trim(" ")  Then
            If Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本周生日员工").ImageFile = "生日.ico" Then
                Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本周生日员工").ImageFile = "生日1.ico"
            Else
                Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本周生日员工").ImageFile = "生日.ico"
            End If
        Else
            Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本周生日员工").ImageFile = "生日1.ico"
        End If
        If Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本月生日员工").text.trim(" ") <> Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本月生日员工").Name.trim(" ")  Then
            If Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本月生日员工").ImageFile = "生日.ico" Then
                Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本月生日员工").ImageFile = "生日1.ico"
            Else
                Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本月生日员工").ImageFile = "生日.ico"
            End If
        Else
            Forms("桌面导航").Controls("TopicBar1").Pages("员工生日提醒").Links("本月生日员工").ImageFile = "生日1.ico"
        End If
    End If
    
    
    Dim cfbar今天生日员工 As RibbonMenu.Button = ConfigBar.Items("常用工具").Items("今天生日员工")
    Dim cfbar本周生日员工 As RibbonMenu.Button = ConfigBar.Items("常用工具").Items("本周生日员工")
    Dim cfbar本月生日员工 As RibbonMenu.Button = ConfigBar.Items("常用工具").Items("本月生日员工")
    If cfbar今天生日员工.text.trim(" ") <> cfbar今天生日员工.Name.trim(" ")  Then
        If cfbar今天生日员工.Enabled = True Then
            cfbar今天生日员工.SmallImage = GetImage("生日1.ico")
            cfbar今天生日员工.Enabled = False
        Else
            cfbar今天生日员工.SmallImage = GetImage("生日.ico")
            cfbar今天生日员工.Enabled = True
        End If
    Else
        cfbar今天生日员工.SmallImage = GetImage("生日1.ico")
        cfbar今天生日员工.Enabled = False
    End If
    
    If cfbar本周生日员工.text.trim(" ") <> cfbar本周生日员工.Name.trim(" ")  Then
        If cfbar本周生日员工.Enabled = True Then
            cfbar本周生日员工.SmallImage = GetImage("生日1.ico")
            cfbar本周生日员工.Enabled = False
        Else
            cfbar本周生日员工.SmallImage = GetImage("生日.ico")
            cfbar本周生日员工.Enabled = True
        End If
    Else
        cfbar本周生日员工.SmallImage = GetImage("生日1.ico")
        cfbar本周生日员工.Enabled = False
    End If
    
    If cfbar本月生日员工.text.trim(" ") <> cfbar本月生日员工.Name.trim(" ")  Then
        If cfbar本月生日员工.Enabled = True Then
            cfbar本月生日员工.SmallImage = GetImage("生日1.ico")
            cfbar本月生日员工.Enabled = False
        Else
            cfbar本月生日员工.SmallImage = GetImage("生日.ico")
            cfbar本月生日员工.Enabled = True
        End If
    Else
        cfbar本月生日员工.SmallImage = GetImage("生日1.ico")
        cfbar本月生日员工.Enabled = False
    End If
End If



--  作者:lzzhx
--  发布时间:2017/10/23 12:28:00
--  
我发现只要一点击“剪切”按钮,我的配置栏的所有菜单就都没有了,所以才会出现找不到常用工具和内置聊天按钮的情况,但为什么配置栏没有了呢?
--  作者:有点甜
--  发布时间:2017/10/23 12:53:00
--  

1、你当前菜单是在用户菜单还是系统菜单?如果在系统菜单里,就不存在你对应的菜单选项。

 

2、你可以加入代码判断是否存在对应的菜单,如 If ConfigBar.Items.Contains("xxxx") Then

 

3、你也可以判断当前是系统菜单还是用户菜单 http://www.foxtable.com/webhelp/scr/1466.htm