QuestionDialog: Difference between revisions
No edit summary |
|||
Line 2: | Line 2: | ||
A fullscreen iup dialog with two buttons that can be used to ask for confirmation and stuff like that. Display with :show() or ShowDialog(). | A fullscreen iup dialog with two buttons that can be used to ask for confirmation and stuff like that. Display with :show() or ShowDialog(). | ||
== Functions == | |||
=== SetMessage === | === SetMessage === | ||
'''Definition:''' | '''Definition:'''<br> | ||
SetMessage(ihandle qdialog, string message, string ltitle, function lcb, string rtitle, function rcb) - | SetMessage(ihandle qdialog, string message, string ltitle, function lcb, string rtitle, function rcb) -> nil | ||
<br><br> | |||
'''Description:''' | '''Description:''' <br> | ||
Sets message plus title and callbacks for the buttons. | Sets message plus title and callbacks for the buttons. | ||
<br><br> | |||
'''Arguments:''' | '''Arguments:'''<br> | ||
'''qdialog''' the question dialog (can be omitted with the colon syntax) | '''qdialog''' the question dialog (can be omitted with the colon syntax)<br> | ||
'''message''' message to display in the dialog | '''message''' message to display in the dialog<br> | ||
'''ltitle''' left button title | '''ltitle''' left button title<br> | ||
'''lcb''' left button callback | '''lcb''' left button callback<br> | ||
'''rtitle''' right button title | '''rtitle''' right button title<br> | ||
'''rcb''' right button callback | '''rcb''' right button callback | ||
<br><br> | |||
'''Returns:''' | '''Returns:''' | ||
<br><br> | |||
'''Example:''' | '''Example:'''<br> | ||
<source lang="lua"> | |||
local function yes_cb() | local function yes_cb() | ||
print( | print("you said yes") | ||
HideDialog(QuestionDialog) | HideDialog(QuestionDialog) | ||
end | end | ||
local function no_cb() | local function no_cb() | ||
print( | print("you said no") | ||
HideDialog(QuestionDialog) | HideDialog(QuestionDialog) | ||
end | end | ||
QuestionDialog:SetMessage( | QuestionDialog:SetMessage("Answer me!", "Yes", yes_cb, "No", no_cb) | ||
ShowDialog(QuestionDialog) | ShowDialog(QuestionDialog) | ||
</source> | |||
<br><br> | |||
< |
Latest revision as of 18:54, 20 November 2010
A fullscreen iup dialog with two buttons that can be used to ask for confirmation and stuff like that. Display with :show() or ShowDialog().
Functions
SetMessage
Definition:
SetMessage(ihandle qdialog, string message, string ltitle, function lcb, string rtitle, function rcb) -> nil
Description:
Sets message plus title and callbacks for the buttons.
Arguments:
qdialog the question dialog (can be omitted with the colon syntax)
message message to display in the dialog
ltitle left button title
lcb left button callback
rtitle right button title
rcb right button callback
Returns:
Example:
<source lang="lua">
local function yes_cb()
print("you said yes")
HideDialog(QuestionDialog)
end
local function no_cb() print("you said no") HideDialog(QuestionDialog) end
QuestionDialog:SetMessage("Answer me!", "Yes", yes_cb, "No", no_cb)
ShowDialog(QuestionDialog)
</source>