CCKit2
    Preparing search index...

    Class CCDialog

    A dialog displays a new window on the screen with the specified message.
    Example image

    TypeScript
    CCDialog.messageWithOneButton(undefined, "Hello", "Hello World!", () => doSomething());
    Lua
    CCDialog:messageWithOneButton(nil, "Hello", "Hello World!", function() doSomething() end)
    TypeScript
    let dialog = new CCDialog();
    dialog.title = "Confirm";
    dialog.message = "Are you sure you want to do this?";
    dialog.buttons = ["No", "Yes"];
    dialog.defaultButton = 0;
    dialog.completionHandler = (_, selection) => {
    if (selection === 1) this.doThing();
    };
    dialog.display(this.view.window);
    Lua
    local dialog = LuaWrappers.new(CCDialog)
    dialog.title = "Confirm"
    dialog.message = "Are you sure you want to do this?"
    dialog.buttons = {"No", "Yes"}
    dialog.defaultButton = 0
    dialog.completionHandler = function(_, selection)
    if selection == 1 then self:doThing() end
    end
    dialog:display(self.view.window)
    Index

    Constructors

    Properties

    buttons: string[] = ...

    The buttons to display in the window, from left to right.

    completionHandler?: (this: void, sender: CCDialog, selection: number) => void

    The function to call when the dialog is closed.

    defaultButton?: number = 0

    The index of the default button.

    message: string = "Alert"

    The message to display in the window.

    title: string = "Alert"

    The title for the alert window.

    Methods

    • Displays the dialog on screen. This returns after creating the window.

      Parameters

      • Optionalparent: CCWindow

        The parent window of the dialog, if available

      Returns void

    • Displays a single-use dialog with a single "OK" button. This returns after creating the window.

      Parameters

      • parent: CCWindow | undefined

        The parent window to place the dialog under

      • title: string

        The title for the dialog

      • message: string

        The message to show

      • OptionalcompletionHandler: (this: void, sender: CCDialog, selection: number) => void

        A function to call when the dialog is closed

      Returns void