Websites Navigation: Airbit | Shop | m-shell.net
Languages: EN | DE

Class abdialog.Dialog

is abguibase.Box is abguibase.Widget
A modal dialog. A modal dialog by default always has a Dialog.okButton and a Dialog.cancelButton at its bottom, and a container Dialog.box where the actual dialog widgets should be added to. On S60 devices, ok and cancel are also invoked by the two option keys.

The following properties are taken from abguibase.theme:

KeyMeaning
dialogbgabguibase.Background for dialogs
dialoginsetinset of dialog box

Once the dialog has been set up, Dialog.run() shows it to the user and waits for ok or cancel to be pressed before returning to the previous view.

Here is a complete example:
query:abdialog.Dialog=abdialog.Dialog(2);
query.box.add(gui.Label("Name:", gui.RIGHT|gui.VCENTER));
name:gui.TextField=gui.TextField()
query.box.add(name);
query.setCentered(); // optional
if query.run() then
  print name.text+" was entered"
end

Constructor

function init(columns=1)
Overridesabguibase.Box.init()
Create a dialog with ok and cancel buttons.
Parameters:
columns – the number of columns in the internal box.

Fields

bgAlpha The alpha to apply when merging the existing view with bgColor. 0 paints it over with bgColor, 1 leaves the existing view unmodified. Default is 0.4.
bgColor The color to paint over the existing view before drawing the dialog. If null, the existing background is not modified. Default is white.
box:abguibase.Box The box for the dialog widgets.
cancelButton:abgui.Button The "Cancel" button.
initialFocus:abguibase.Widget The widget which should get the initial focus, null to keep the last focus.
okButton:abgui.Button The "OK" button.

Functions

handled(event) [Inherited comment] Handle an ui.cmd() event, or have a child handle it.
run() "Run" the dialog, i.e. show it and wait for ok or cancel.
function run()
"Run" the dialog, i.e. show it and wait for ok or cancel.
Returns:true if ok was pressed, false if cancel was pressed.
function handled(event)
Overridesabguibase.Box.handled()
[Inherited comment] Handle an ui.cmd() event, or have a child handle it.
Parameters:
event – the event to handle.
Returns:true if this widget or one of its children handled the event.
mShell Home  > Documentation  > mdoc