[doc] RadioButtonWidget (#9733)

reviewable/pr9735/r1
zwim 2 years ago committed by GitHub
parent 07748b0999
commit 48a1f53d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,7 @@
--[[--
A button table to be used in dialogs and widgets.
]]
local Blitbuffer = require("ffi/blitbuffer")
local CheckButton = require("ui/widget/checkbutton")
local Device = require("device")

@ -1,3 +1,34 @@
--[[--
Widget that allows selecting an entry from a @{ui.widget.radiobuttontable|RadioButton} list.
Example:
local RadioButtonWidget = require("ui/widget/radiobuttonwidget")
local radio_buttons = {
{ {text = _("Radio 1"), provider = 1} },
{ {text = _("Radio 2"), provider = 2, checked = true} },
{ {text = _("Radio 3"), provider = "identifier"} },
}
UIManager:show(RadioButtonWidget:new{
title_text = _("Example Title"),
info_text = _("Some more information"),
cancel_text = _("Close"),
ok_text = _("Apply"),
width_factor = 0.9,
radio_buttons = radio_buttons,
callback = function(radio)
if radio.provider == 1 then
-- do something here
elseif radio.provider == 2 then
-- do some other things here
elseif radio.provider == "identifier" then
-- or do a third thing here
end
end,
})
]]
local Blitbuffer = require("ffi/blitbuffer")
local ButtonTable = require("ui/widget/buttontable")
local CenterContainer = require("ui/widget/container/centercontainer")

Loading…
Cancel
Save