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 aGUI
box, or in inside of anotherBox
which in turn is inside aGUI
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 callingWidget:HIDE
andWidget: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. SHOW
none Call to make the gui appear HIDE
none Call to make the gui disappear -
GUI:
X
¶ Type: scalar
Access: 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
Access: 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
Access: 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
andGUI:Y
, but can’t be moved by the user.
-
GUI:
EXTRADELAY
¶ Type: scalar
Access: 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
Access: Get/Set A
Skin
is a collection ofStyle
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:
SHOW
()¶ Synopsis:
set g to gui(200). // .. call G:addbutton, G:addslider, etc etc here 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 G:addbutton, G:addslider, etc etc here g:show(). wait until done. // whatever you decide "done" is. g:hide().
Call this suffix to make the GUI disappear. (Note this is really just
Widget:Show
but it’s mentioned again here.)
-
GUI: