Project

General

Profile

Actions

Create a button

_gtkButtonNew :

Create a button.
One function to create these buttons :

  • Classic (flag = SCOL_GTK_BUTTON_LABEL)

  • With Mnemonic (like a keybord shortcut) (flag = SCOL_GTK_BUTTON_MNEMONIC)

  • With a stock item (standard icon like "open", "exit", "copy", ...) (flag = SCOL_GTK_BUTTON_STOCKITEM)
  • With a link (uri) (flag = SCOL_GTK_BUTTON_LINK)

  • A check box (with a short label) (flag = SCOL_GTK_BUTTON_CHECK)

  • With a toggle state (flag = SCOL_GTK_BUTTON_TOGGLE)

  • With a switch (flag = SCOL_GTK_BUTTON_SWITCH)

  • A radio button with label (flag = SCOL_GTK_BUTTON_RADIO)

  • An empty button (flag = SCOL_GTK_BUTTON_EMPTY) : can add a valid widget, like an image widget, etc ...

Prototype :

fun [Chn S I u0] ObjGtkWidget

  • Channel : Chn

any channel

  • Label : S

Can be any label (with SCOL_GTK_BUTTON_LABEL, SCOL_GTK_BUTTON_TOGGLE, SCOL_GTK_BUTTON_SWITCH)

a mnemonic label (with SCOL_GTK_BUTTON_MNEMONIC)

or a stock item name (with SCOL_GTK_BUTTON_STOCKITEM).

Should be nil with SCOL_GTK_BUTTON_EMPTY.

  • flag : I

SCOL_GTK_BUTTON_EMPTY : empty button. Cf 'param'.

SCOL_GTK_BUTTON_LABEL : classical button with the label 'label'.

SCOL_GTK_BUTTON_MNEMONIC : a button with a mnemonic (can be activate with ALT + key).

SCOL_GTK_BUTTON_STOCKITEM : a button with a standard stock item.

SCOL_GTK_BUTTON_LINK : button with a link (uri).

SCOL_GTK_BUTTON_CHECK : check button (with mnemonic) with a short label

SCOL_GTK_BUTTON_TOGGLE : toggle button

SCOL_GTK_BUTTON_SWITCH : switch button. GTK+ 3.0 or + is needed. Otherwise, a toggled button will be created.

SCOL_GTK_BUTTON_RADIO : a radio button. You can see Examples section for more details to include it

  • param : u0

A supplemental parameter if flag need

ObjGtkWidget : child. If Type is SCOL_GTK_BUTTON_EMPTY only , child will be displayed into the new button.

S : url if type set to SCOL_GTK_BUTTON_LINK only

I : active (1), inactive (0) if flag is SCOL_GTK_BUTTON_CHECK, SCOL_GTK_BUTTON_TOGGLE or SCOL_GTK_BUTTON_SWITCH

[ObjGtkWidget I] : if the flag is SCOL_GTK_BUTTON_RADIO : object is the first button group (so, nil if it's the first !), the integer is the initial state (1 or 0).

WARNING : the type of the last argument is u0. Be careful : your type should be the good type (S if flag is SCOL_GTK_BUTTON_LINK by example). Otherwise, your application will compile but it will risk to crash to the running.

Return : ObjGtkWidget

The new Scol button object or nil if error

Return Buttons

Updated by iri almost 14 years ago ยท 9 revisions