Gambas/時間
外觀
< Gambas
返回 Gambas
Time 返回當前時間。示例
你需要一個按鈕
Private Sub Button1_click() message(time) end
它會給你這樣的結果:22:13:00.998(在 Ubuntu 上它會顯示為這樣:P)
例如,如果我們想在某個特定時間提醒我們,它應該是這樣的
你需要 2 個文字框、1 個按鈕、1 個計時器和一個模組。
在文字框 1 中,我們輸入要提醒我們的小時。在文字框 2 中,我們輸入要提醒我們的分鐘。
在模組中寫入
PUBLIC Hora as string[] PUBLIC Final as string[]
在窗體 Fmain 中,按鈕 1 寫入
Private Sub Button1_click()
dim tiempo as String
tiempo=Time
Module1.Hora=Split(tiempo,":")
Timer1.enabled = true
end
Private Sub Timer1_()
dim tiempo as string
Timer1.delay = 500
tiempo=Time
Module1.Final=split(tiempo,":")
if Module1.hora[0] = Module1.Final[0] and Module1.hora[1] = Module1.Final[1] then
message.info("Ya es la hora que ingresaste antes")
Timer1.enabled = false
end if
end
語法是
WAIT [ Delay ]
此命令呼叫事件迴圈。如果指定了 Delay,它將不會返回,直到 Delay 秒過去。Delay 是一個浮點數。因此,如果您想等待 100 毫秒,只需執行
WAIT 0.1
在等待期間,不會處理鍵盤或滑鼠事件。只有繪製、計時器和檔案描述符事件,如 Process_Write 仍在執行。
示例
你需要一個命令按鈕和一個文字框來啟動它。
PUBLIC SUB Button1_Click() WAIT 10 'waits 10 seconds WAIT 0.1 'waits 100 milliseconds textbox1.Text = "" END