簡體   English   中英

從Base(Libreoffice)宏中獲取按鈕

[英]Getting a button from Macro in Base (Libreoffice)

我正在嘗試創建一個簡單的宏來控制放置在表單中的兩個按鈕。 它們交替放置,因此可以使其處於按下狀態或不按下狀態,目的是僅使其中之一處於按下狀態。 我的想法是每次按下兩個宏中的一個時執行一個宏,然后該宏負責取消另一個宏。

有任何想法嗎?

非常感謝!

以下代碼來自https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=34337 它適用於基本表單以及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

或使用單選按鈕,這通常表示一次只能選擇一個。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM