Radiobutton.constructor(parent, caption, [ x ], [ y ], [ width ], [ height ]) constructor


The Radiobutton constructor returns a Radiobutton value representing a push radiobutton on the parent object.

  • A Radiobutton is always used in groups, grouped by their parent object.
  • Radiobuttons are exclusive in the same group : selecting one deselects the others.

Parameters

parent

An object that will own the Radiobutton. Parent objects can be any of Window, Groupbox, TabItem and Panel

caption

A string representing the Radiobutton's text.

x

An optional number that indicates the Radiobutton horizontal position, in pixels. Zero means the left border of the parent.

y

An optional number that indicates the Radiobutton vertical position, in pixels. Zero means the top border of the parent.

width

An optional number that indicates the Radiobutton width in pixels, autosized to fit text content if omitted.

height

An optional number that indicates the Radiobutton height in pixels, autosized to fit text content if omitted.

Example

local ui = require "ui" -- create a simple Window local win = ui.Window("Radiobutton.constructor() sample", 320, 200) -- create a Radiobutton on this window, with "LuaRT" as text, at the x position 110, and y position 80 local radiobutton = ui.Radiobutton(win, "Check if LuaRT is fun", 100, 80) function radiobutton:onClick() if self.checked then ui.info("Thank you !") end end win:show() -- update the user interface until the user closes the Window repeat ui.update() until not win.visible