gtk-sharp 2.12.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. Gtk.Button A button that can be toggled on and off.

A is a which will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to its normal state. This is useful if you need to maintain the state of a button.

`using Gtk; using System; public class ToggleButtonApp { ToggleButton btn; public static int Main (string[] args) { new ToggleButtonApp(); return 0; } public ToggleButtonApp() { Application.Init (); Window win = new Window ("ToggleButton Tester"); win.SetDefaultSize (200, 150); win.DeleteEvent += new DeleteEventHandler (Window_Delete); btn = new ToggleButton ("Unselected"); btn.Active = false; btn.Toggled += new EventHandler (btn_toggled); win.Add (btn); win.ShowAll (); Application.Run (); } void btn_toggled (object obj, EventArgs args) { Console.WriteLine ("Button Toggled"); if (btn.Active) { btn.Label = "Unselected"; } else { btn.Label = "Selected"; } } static void Window_Delete (object obj, DeleteEventArgs args) { Application.Quit (); args.RetVal = true; } }`
- Constructor
  2.12.0.0
  Creates a new object

  Creates a new , which is a . A widget should be packed inside the toggle button using .

  `Label label = new Label(); ToggleButton btn = new ToggleButton (); btn.Add(label);`

- Constructor
  2.12.0.0
  System.Obsolete
  a
  Protected Constructor.
  Chain to this constructor if you have manually registered a native value for your subclass.
- Constructor
  2.12.0.0
  Pointer to the C object.
  Internal constructor

  This is an internal constructor, and should not be used by user code.

- Constructor
  2.12.0.0
  a containing the message to be placed in the toggle button.
  Creates a new with a text label.
  Creates a new with a text label. `ToggleButton btn = new ToggleButton ("ToggleButton");`
- Property
  2.12.0.0
  GLib.Property("active")
  System.Boolean Get or set the active an object of type

  Get or set the active.

  Get: Queries a and returns its current state. Returns if the toggle button is pressed in and if it is raised.

  `if (btn.Active) { Console.WriteLine("The ToggleButton is pressed in"); } else { Console.WriteLine("The ToggleButton is raised"); }`

  Set: Sets the status of the toggle button. Set to if you want the GtkToggleButton to be 'pressed in', and to raise it. This action causes the toggled signal to be emitted.

  `// set the togglebutton active // and appear "pressed in" btn.Active = true;`
- Property
  2.12.0.0
  GLib.Property("draw-indicator")
  System.Boolean Determines the drawing style of a or an object of type The DrawIndicator property can be set to to make or look like a normal .
- Property
  2.12.0.0
  GLib.GType GType Property. a Returns the native value for .
- Property
  2.12.0.0
  GLib.Property("inconsistent")
  System.Boolean Determines if the has an intermediate state. an object of type

  If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a , and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. This function turns on "in between" display. Normally you would turn off the inconsistent state again if the user toggles the . This has to be done manually, only affects visual appearance, it does not affect the semantics of the .

- Property
  2.12.0.0
  System.Boolean The Mode of the an object of type

  The Mode of the

  Sets whether the button is displayed as a separate indicator and label. You can call this function on a or a with = to make the button look like a normal button

  This function only effects instances of classes like and that derive from , not instances of itself.

- Method
  2.12.0.0
  Gtk.ToggleButton `` a containing the message to be placed in the toggle button. Creates a new with a text label. a new . Creates a new with a text label.
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideToggled", Type=typeof(Gtk.ToggleButton))
  System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Method
  2.12.0.0
  System.Void Emits the event Emits the event on the . There is no good reason for an application ever to call this function.
- Event
  2.12.0.0
  GLib.Signal("toggled")
  System.EventHandler Triggered when the is clicked. Should be connected if you wish to perform an action whenever the state changes. `ToggleButton btn = new ToggleButton("ToggleButton"); btn.Toggled += new EventHandler (btn_toggled); void btn_toggled (object obj, EventArgs args) { // code for toggled event here }`