跳轉到內容

SuperCard 程式設計/基礎/欄位

來自華夏公益教科書,開放的書籍,開放的世界

SuperCard 中的欄位用於儲存文字。


欄位屬性

[編輯 | 編輯原始碼]

欄位具有樣式屬性。

文字是欄位的內在屬性。實際上,欄位的文字屬性在獲取或設定時無需命名。實際上,與其他語言和程式設計環境相比,這可能看起來違反直覺。要獲取或設定欄位的文字,只需將文字字串或變數放入或從欄位中獲取或放入。請參閱以下欄位語法示例。

欄位語法

[編輯 | 編輯原始碼]

獲取欄位內容

[編輯 | 編輯原始碼]

您可能認為您可以簡單地執行以下操作

-- WARNING!! Incorrect Code!
get field [name of field]
put it into [variable name]

但是,欄位屬於卡片或背景,因此在獲取或設定欄位中的文字時,您必須指定此項

get [cd/card/bg/background] field [name of field]
put it into [variable name]
put [cd/card/bg/background] field [name of field] into [variable name]

放入(即設定)欄位內容

[編輯 | 編輯原始碼]

與獲取欄位內容一樣,在放入資料時,您必須指定卡片或背景

put [literal string/variable name] into [cd/card/bg/background] field [name of field]

迴圈遍歷卡片或背景的欄位

[編輯 | 編輯原始碼]
repeat with x = 1 to the number of [cd/card/bg/background] fields
[code to work with fields]
-- example [cd/card/bg/background] field x
end repeat
華夏公益教科書