檢視原始碼 wxChoice (wx v2.4.3)
選取項目用於從字串列表中選擇一個項目。
與 wxListBox
不同,只有在使用者下拉選單時才會顯示選擇。
樣式
此類別支援以下樣式
- wxCB_SORT:依字母順序排序項目。
請參閱
此類別繼承自以下類別,並可使用其函式:
wxWidgets 文件:wxChoice
事件
此類別發出的事件類型
摘要
類型
-type wxChoice() :: wx:wx_object().
函式
-spec create(This, Parent, Id, Pos, Size, Choices) -> boolean() when This :: wxChoice(), Parent :: wxWindow:wxWindow(), Id :: integer(), Pos :: {X :: integer(), Y :: integer()}, Size :: {W :: integer(), H :: integer()}, Choices :: [unicode:chardata()].
-spec create(This, Parent, Id, Pos, Size, Choices, [Option]) -> boolean() when This :: wxChoice(), Parent :: wxWindow:wxWindow(), Id :: integer(), Pos :: {X :: integer(), Y :: integer()}, Size :: {W :: integer(), H :: integer()}, Choices :: [unicode:chardata()], Option :: {style, integer()} | {validator, wx:wx_object()}.
從控制項中刪除一個項目。
如果客戶端資料是由控制項擁有的,則與項目關聯的客戶端資料也會被刪除。請注意,刪除索引為負值或大於或等於控制項中項目數的項目會導致錯誤(在偵錯版本中會觸發斷言失敗)。
如果在要刪除的項目下方有目前選取的項目,也就是說,如果 wxControlWithItems:getSelection/1
傳回大於或等於 n
的有效索引,則在呼叫此函式時,選取將會失效。但是,如果選取的項目出現在要刪除的項目之前,則選取將保持不變。
-spec destroy(This :: wxChoice()) -> ok.
銷毀物件
取得此選取項目中的欄數。
備註:此功能僅在 GTK 和 Motif 上實作,在其他平台上始終傳回 1。
-spec new() -> wxChoice().
預設建構子。
參見:create/7
-spec new(Parent, Id) -> wxChoice() when Parent :: wxWindow:wxWindow(), Id :: integer().
等同於 new(Parent, Id, [])
。
-spec new(Parent, Id, [Option]) -> wxChoice() when Parent :: wxWindow:wxWindow(), Id :: integer(), Option :: {pos, {X :: integer(), Y :: integer()}} | {size, {W :: integer(), H :: integer()}} | {choices, [unicode:chardata()]} | {style, integer()} | {validator, wx:wx_object()}.
建構子,建立並顯示一個選取項目。
參見:create/7
-spec setColumns(This) -> ok when This :: wxChoice().
等同於 setColumns(This, [])
。
設定此選取項目中的欄數。
備註:此功能僅在 GTK 和 Motif 上實作,在其他平台下不會執行任何動作。