GtkButton Class

The GtkButton class is the class for instantiating push button widgets.

The class heirarchy


   Object
      +---GtkWidget
         +---GtkContainer
            +---GtkButton

The methods for the GtkButton class are documented below.

GtkButton Method Table of Contents

new - Create and initialize the widget
label - Get the label text of a button
label = - Set the label text of a button


Method: new

This method creates and initializes the widget.

Example

This is a example of how to create a new push button widget.


text = 'Press me'
mybutton = .GtkButton~new(text)

Method Parameters

text
(Optional) The label text for the button. See the label = method for a list of available pre-assigned labels.

Method Results

The new GtkButton object.




Method: label

This method retrieves the label text from the button.

Example

This is a example of how to retrieve the label text of a button.


text = mybutton~label()

Method Parameters

None.

Method Results

text
The label text for the button.



Method: label =

This method sets the label text of the button.

Example

This is a example of how to set the label text of a button.


text = 'Ok'
mybutton~label = text

text = 'gtk-ok'  /* preassigned label */
mybutton~label = text

Method Parameters

text
The new label text for the button.

Notes

GTK+ provides some preassigned labels that can be used as the text of a button. They also provide a nice graphic which will also be displayed on the button. Here are some of the preassigned labels available to you.

gtk-add
gtk-apply
gtk-cancel
gtk-close
gtk-delete
gtk-execute
gtk-find
gtk-new
gtk-no
gtk-ok
gtk-open
gtk-print
gtk-quit
gtk-save
gtk-save-as
gtk-select-font
gtk-stop
gtk-undo
gtk-yes
gtk-

Note that all the preassigned labels begin with the prefix string 'gtk-'. Your own labels can use any other string that does not contain the 'gtk-' prefix.

Method Results

None.




Valid XHTML 1.0!