Last updated
Last updated
此頁面介紹各種控制元件的類別,可供開發者加入 LRemote 所創建的控制畫面之中:
LRemoteLabel: 靜態的單行文字標籤
LRemoteButton: 帶有文字標籤的簡單按鈕
LRemoteCircleButton: 帶有文字標籤的圓形按鈕
LRemoteSlider: 可設定初始值與數值範圍的滾動軸
LRemoteSwitch: 可切換開與關的按鈕
LRemoteJoystick: 類比搖桿
要使用這些類別之前,請確保將它們宣告為全域變數:
接著可以設定控制元件的文字、大小、位置、顏色等等資訊,然後透過 LRemote.addControl() 將其加入控制畫面中。
setText()
setColor()
setPos()
setSize()
設定控制元件的文字標籤
Syntax
text: 文字標籤
Returns
none
isValueChanged(
getValue()
檢查遠端的 LinkIt Remote 手機程式是否已經修改 UI control
Check if the LinkIt Remote app has made a change to the UI control
Syntax
isValueChanged()
Parameters
none
Returns
true 表示 LinkIt Remote 曾經傳送過指令給 LInkIt 7699。
false 表示,在上一次呼叫 LRemote.process() 之後,都沒有來自 LinkIt Remote 手機程式的指令。
setValueRange()
設定滾動軸允許的最小、最大值
Syntax
min_value: 滾動軸最左端代表的值。最小不能小於 -32767
max_value: 滾動值最右端代表的值。此值不能夠大於 32767
init_value: 滾動軸的初始值
Returns
none
updateText()
改變文字標籤。即便 LinkIt Remote 程式已經連接了,還是可以用此方法更新文字標籤的內容。
Syntax
new_text: 要更新的文字標籤,長度不能夠超過 15 bytes。
Returns
none
LRemoteSlider
當前捲動軸的數值
LRemoteButton
LRemoteCircleButton
1: 按鈕被按下
0: 按鈕被釋放
LRemoteSwitch
1: 開啟開關
0: 關閉開關
LRemoteJoystick
回傳一個 LRemoteDirection物件,開發者可以使用 .x 來存取 X 軸的數值,用 .y 來存取 Y 軸的數值。
回傳的數值介於 -100 到 100 之間。 -100 代表最左邊/下面,100代表最右邊/上面。