User:NXTBoy/Sandbox

From Legacy Roblox Wiki
Jump to navigationJump to search

Alternative to RbxGui#The_API. Better? Worse?

CreateSlider

CreateSlider(steps, width, position)

Parameters:

numberstepsThe number of different positions the slider can be in along the bar
numberwidthWidth in pixels of the slider
UDim2positionThe location to place the slider gui in

Returns:

FramesliderGuiThe container of the entire slider gui
IntValuesliderPositionHolds the current value of the step the slider is on - readable and writable

Returns 2 objects, (sliderGui, sliderPosition). 'sliderGui' is a frame that contains the entire slider gui. 'sliderPosition' is an IntValue whose current value specifies the specific step the slider is currently on (This value can be modified by a script, and the slider with adjust position). The 'steps' argument specifies how many different positions the slider can hold along the bar. 'width' specifies in pixels how wide the bar should be (modifiable afterwards if desired). 'position' argument should be a UDim2 for slider gui positioning.

CreateScrollingFrame

CreateScrollingFrame(orderList, style)

Parameters:

tableorderList
stringstyle

Returns:

FramescrollFrame
ImageButtonscrollUpButton
ImageButtonscrollDownButton
functionrecalculateFunction

Returns 4 objects, (scrollFrame, scrollUpButton, scrollDownButton, recalculateFunction). 'scrollFrame' can be filled with GuiObjects. It will lay them out and allow scrollUpButton/scrollDownButton to interact with them. orderList is an optional argument (and specifies the order to layout the children. Without orderlist, it uses the children order) style is also optional, and allows for a 'grid' styling if style is passed 'grid' as a string. recalculateFunction can be called when a relayout is needed (when orderList changes, or when scrollFrame size changes).

AutoTruncateTextObject

AutoTruncateTextObject(textLabelToAutoTruncate)

Parameters:

TextLabeltextLabelToAutoTruncate

Returns:

TextLabelautoTruncatingTextLabel
FunctionchangeTextA function that can be used to change the text, taking a string as an argument.

Returns 2 objects, (autoTruncatingTextLabel, changeText). The 'textLabelToAutoTruncate' input is modified to automatically truncate text (with ellipsis), if it gets too small to fit.

CreateScrollingFrame

CreateScrollingFrame(orderList, style)

Parameters:

tableorderList
stringstyle

Returns:

FramescrollFrame
ImageButtonscrollUpButton
ImageButtonscrollDownButton
functionrecalculateFunction

Returns 4 objects, (scrollFrame, scrollUpButton, scrollDownButton, recalculateFunction). 'scrollFrame' can be filled with GuiObjects. It will lay them out and allow scrollUpButton/scrollDownButton to interact with them. orderList is an optional argument (and specifies the order to layout the children. Without orderlist, it uses the children order) style is also optional, and allows for a 'grid' styling if style is passed 'grid' as a string. recalculateFunction can be called when a relayout is needed (when orderList changes, or when scrollFrame size changes).

GetFontHeight

GetFontHeight(font, fontSize)

Parameters:

Fontfont
FontSizefontSize

Returns:

numberpixelSize

Returns the vertical size in pixels of the given font + fontSize.

CreateStyledMessageDialog

CreateStyledMessageDialog(title, message, style, buttons)

Parameters:

stringtitle
stringmessage
stringstyle
tablebuttons

Returns:

InstancemessageContainer

Returns a gui object of a message box with 'title' and 'message' as passed in. 'buttons' input is an array of Tables contains a 'Text' and 'Function' field for the text/callback of each button, 'style' is a string, either 'Error', 'Notify' or 'Confirm'.

CreateMessageDialog

CreateMessageDialog(title, message, buttons)

Parameters:

stringtitle
stringmessage
tablebuttons

Returns:

InstancemessageContainer

Returns a gui object of a message box with 'title' and 'message' as passed in. 'buttons' input is an array of tables that contains a 'Text' and 'Function' field for the text/callback of each button.

CreateDropDownMenu

CreateDropDownMenu(items, onItemSelected)

Parameters:

tableitems
functiononItemSelected

Returns:

InstanceguiContainer
functionupdateSelection

First argument should be a table full of strings that will populate menu. Second argument should be a function that takes one argument, and is called when a user selects a new object in the drop down menu. Returns 2 results, a gui container to the gui object and a 'updateSelection' function for external updating. The container is a drop-down-box created around a list of items.

CreatePropertyDropDownMenu

CreatePropertyDropDownMenu(descendant, propertyName, enumType)

Parameters:

Instancedescendant
stringpropertyName
EnumenumType

Returns:

InstanceguiContainer

returns a container with a drop-down-box that is linked to the 'property' field of 'instance' which is of type 'enumType'.