# GUI structure¶

structure GUI

This object is created with the GUI(width,height) function.

A GUI object is a kind of Box that is the outermost window that holds all the other widgets. In order to work at all, all widgets must be put inside of a GUI box, or in inside of another Box which in turn is inside a GUI box, etc.

(To get rid of all GUIs that you created from this CPU, you can use the CLEARGUIS built-in-function, which is a shorthand for calling Widget:HIDE and Widget:DISPOSE on each of them.)

Suffix Type Description
Every suffix of BOX. Note, to add widgets to this window, see the BOX suffixes.
X scalar (pixels) X-position of the window. Negative values measure from the right.
Y scalar (pixels) Y-position of the window. Negative values measure from the bottom.
DRAGGABLE Boolean True = user can move window.
EXTRADELAY scalar (seconds) Add artificial delay to all communication with this GUI (good for testing before you get into deep space)
SKIN Skin The skin defining the default style of widgets in this GUI.
TOOLTIP String Current value of hovertext
SHOW none Call to make the gui appear
HIDE none Call to make the gui disappear
GUI:X
Type: scalar Get/Set

This is the X position of upper-left corner of window, in pixels.

You can alter this value to move the window.

If you use a negative value for the coordinate, then the coordiante will be measured in the reverse direction, from the right edge of the screen. (i.e. setting it to -200 means 200 pixels away from the right edge of the screen.)

GUI:Y
Type: scalar Get/Set

This is the Y position of upper-left corner of window, in pixels.

You can alter this value to move the window.

If you use a negative value for the coordinate, then the coordiante will be measured in the reverse direction, from the bottom edge of the screen. (i.e. setting it to -200 means 200 pixels away from the bottom edge of the screen.)

GUI:DRAGGABLE
Type: Boolean Get/Set

Set to true to allow the window to be moved by the user dragging it. If set to false, it can still be moved by the script setting GUI:X and GUI:Y, but can’t be moved by the user.

GUI:EXTRADELAY
Type: scalar Get/Set

This is the number of extra seconds of delay to add to the GUI for testing purposes.

If Remote Tech is installed, the GUI system obeys the signal delay of the Remote Tech mod such that when you click a widget it can take time before the script notices you did so. If you want to test how your GUI will work under a signal delay you can use this suffix to force a simulated additional signal delay even if you are not using RemoteTech. (Or when you are using RemoteTech but are testing your GUI in situations where there isn’t a noticable signal delay, like in Kerbin low orbit).

GUI:SKIN
Type: Skin Get/Set

A Skin is a collection of Style objects to be used by different types of widgets within the GUI window. With this suffix you can assign a different Skin to the window, which will then be used by default by all the widgets of the appropriate type inside the window.

GUI:TOOLTIP
Type: String Get/Set

If the mouse pointer is hovering over a GUI label widget inside this window somewhere that has its Label:TOOLTIP property set, then this string will contain that TOOLTIP property copied into it (otherwise it will be an empty string, ""). This is the value that will be displayed inside this window’s TipDisplay widget if you add a TipDisplay widget to the window. Using this value, you can come up with your own alternate ways to display tooltips to the user, if you like, instead of using the baked-in TipDisplay technique.

GUI:SHOW()

Synopsis:

set g to gui(200).
g:show().


Call this suffix to make the GUI appear. (Note this is really just Widget:Show but it’s mentioned again here because it’s vital when making a GUI to know that it won’t show up if you don’t call this.)

GUI:HIDE()

Synopsis:

set g to gui(200).

Call this suffix to make the GUI disappear. (Note this is really just Widget:Show but it’s mentioned again here.)