【问题标题】:Getting a button from Macro in Base (Libreoffice)从 Base (Libreoffice) 中的宏中获取按钮
【发布时间】:2017-10-04 09:21:15
【问题描述】:

我正在尝试创建一个简单的宏来控制已放置在表单中的两个按钮。它们交替位置,因此它们可以被按下或不被按下,目标是只按下其中一个。我的想法是每次按下两者之一时执行一个宏,而宏将负责取消按下另一个。

有什么想法吗?

非常感谢!

【问题讨论】:

    标签: libreoffice basic libreoffice-basic libreoffice-base


    【解决方案1】:

    以下代码来自https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=34337。它适用于 Base 表单和 Calc。

    Sub subButtonDisableButton2(Event As Object)
       Dim oForm As Object
       Dim oModelButton As Object
       'We get the model of the form from the button who calls the macro
       oForm=Event.Source.Model.Parent
       'Now we get the model of button2
       oModelButton=oForm.GetByName("button2")
       'And we disable it!
       oModelButton.Enabled=False
    End Sub
    

    或者使用单选按钮,这通常表示一次只能选择一个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多