檢視原始碼 wxToggleButton (wx v2.4.3)

wxToggleButton 是一個按鈕,當使用者點擊時會保持按下狀態。

換句話說,它在功能上類似於 wxCheckBox,但外觀像 wxButton

自 wxWidgets 2.9.0 版本起,此控制項會發出 UI 更新事件。

您可以在 page_samples_widgets 中查看 wxToggleButton 的實際運作。

請參閱

此類別繼承自以下類別,並可以使用其功能:

wxWidgets 文件:wxToggleButton

事件

此類別發出的事件類型

摘要

函式

建立用於兩步驟建構的切換按鈕。

銷毀物件

取得切換按鈕的狀態。

預設建構子。

建構子,建立並顯示一個切換按鈕。

將切換按鈕設定為給定的狀態。

類型

-type wxToggleButton() :: wx:wx_object().

函式

此函式的連結

create(This, Parent, Id, Label)

檢視原始碼
-spec create(This, Parent, Id, Label) -> boolean()
                when
                    This :: wxToggleButton(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Label :: unicode:chardata().

等同於 create(This, Parent, Id, Label, [])

-spec create(This, Parent, Id, Label, [Option]) -> boolean()
                when
                    This :: wxToggleButton(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Label :: unicode:chardata(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()} |
                        {validator, wx:wx_object()}.

建立用於兩步驟建構的切換按鈕。

詳情請參閱 new/4

-spec destroy(This :: wxToggleButton()) -> ok.

銷毀物件

-spec getValue(This) -> boolean() when This :: wxToggleButton().

取得切換按鈕的狀態。

回傳值:如果按下則回傳 true,否則回傳 false。

-spec new() -> wxToggleButton().

預設建構子。

此函式的連結

new(Parent, Id, Label)

檢視原始碼
-spec new(Parent, Id, Label) -> wxToggleButton()
             when Parent :: wxWindow:wxWindow(), Id :: integer(), Label :: unicode:chardata().

等同於 new(Parent, Id, Label, [])

-spec new(Parent, Id, Label, [Option]) -> wxToggleButton()
             when
                 Parent :: wxWindow:wxWindow(),
                 Id :: integer(),
                 Label :: unicode:chardata(),
                 Option ::
                     {pos, {X :: integer(), Y :: integer()}} |
                     {size, {W :: integer(), H :: integer()}} |
                     {style, integer()} |
                     {validator, wx:wx_object()}.

建構子,建立並顯示一個切換按鈕。

請參閱:create/5

-spec setValue(This, State) -> ok when This :: wxToggleButton(), State :: boolean().

將切換按鈕設定為給定的狀態。

這不會導致發出 EVT_TOGGLEBUTTON 事件。