NkGenie - dialog

From Riftui Wiki

Jump to: navigation, search

This widgets is used for displaying dialogs to the user. You'd want to use this widget for notifications and similar simple messages. You could use a window widget for this, but using nkExtDialog is much simpler and requiring much less parameters than a window.

The widget allows for two different designs. One is using the standard Rift window UI elements (nkExtRiftWindow). The other will build the the nkExtWindow widget to build the dialog. While the first will perfectly match the standard UI, the later will give you more options in terms of coloring. Please see the individual window widgets for more information.

Which design is used is defined by the parameter 'rdesign' at widget creation time.

Of course the dialog widget will be dragable on the screen in either case.

UI.CreateFrame('nkExtDialog', name, parent, {})


Supported parameters

Due to the nature of the dialog widget you cannot change it as dynamically as other widgets after creation. The following parameters are supported for UI:CreateFrame(). The method :update() only supports the parameter 'message' and 'anchors'.

Parameter Description
fontsize The fontsize used for displaying the message in the dialog
rdesign The parameter will tell the dialog to use the Rift internal design. (true = Rift design, false = nkGenie design)
layer The layer used for displaying the dialog versus parent
width The width of the dialog
height The height of the dialog
title The titel of the dialog
color Specifies the color of the widget. See below.
anchors The position of the mask widget. See How to position widgets
okButton Optional, specifies wether and ok button should be shown.
func An optional function which is called if the ok button is clicked.
confirmButton Optional, specifies wether and yes and now button should be shown
funcYes An optional function which is called if the yes button is clicked.
funcNo An optional function which is called if the no button is clicked.

Supported Methods


This method retrieves the underlying Rift UI element.


This method returns the body of the widget used to build the dialog. In case of a rift type display this will return the content element of the window used for the dialog. In case of a nkGenie display this will be slightly more complicated. The nkGenie display will use a window built using several frames (header, body and footer - see window widget). The body element of that window will then be returned by getBody. As the element in question again has a border and body element you can specify which of the both you'd like to receive by setting the paramter to true (inner body) or false (border of body).


This method is only usefull in case you are using the nkGenie design. It will return the header element of the underlying windet widget. That header element is a frame widget.


This method is only usefull in case you are using the nkGenie design. Supply the parameter 'body' will get you the body element of the dialog (which is a frame widget) and 'header' will get you the header element (which is a frame widget).

Other supported methods

Parameter Description
getHeaderTitle() Returns the header title of the widget
setHeaderTitel(text) Sets the header title
SetVisible() Sets the visibility state of the widget (true / false)
IsVisible() Returns the visibility status of the widget. Actually inconsistent and will eventually be changed to GetVisible()

Setting the color of the dialog

What color value you have to supply is dependend on wether you use the Rift or the nkGenie design.

Rift design

If you use the rift design you only have to supply a color for the message which is supposed to be display using the folowing LUA table format: color = { message = 'hex code' }

nkGenie design

If you use the nkGenie design, things are a bit more complicated color wise. You'll have to supply a LUA table with a lot of properties:

color = { border = 'hex code', body = 'hex code', header = 'hex code', title = 'hex code', alpha = int, message = 'hex code' }

The dialog is build using a couple of nkExtFrame which allow for much more colorization options than the standard UI window.

option Description
border The color used for all borders of the frames (header and body both have a border which gets the same color)
header The color used to fill the header frame
title The color used for the text display in the header
body The color used to fill the body frame
message The color used for the message text displayed within body
alpha This optional parameter allows for setting an alpha level of the dialog
Personal tools