generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

_G.gloo.ScrollBar?

Previous Thread :: Next Thread 
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 06:26 PM
Can someone help me figure out where to put the objects being scrolled?

local barTab,ScrollBar = _G.gloo.ScrollBar()
for n=1,5 do
local f = Instance.new("TextLabel")
f.Parent = -- What?
end
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 06:43 PM
Nobody?
Report Abuse
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
21 Jul 2013 06:44 PM
I don't understand the question.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 06:46 PM
Gloo?

Never heard of it, sounds sticky.
Report Abuse
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
21 Jul 2013 06:47 PM
It's a global function, apparently.

You have the code for _G["gloo.Scrollbar"] too?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 06:49 PM
You mean

_G["gloo"]["Scrollbar"]

.
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 06:49 PM
I found _G.gloo a few days ago, I don't know where the source code is, or I would figure it out myself in a few seconds, but I don't so.. I'm here! :D

If you don't know what gloo is, run this in the command bar, _G.gloo.Help()
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 06:50 PM
_G.gloo.ScrollBar runs the same as _G["gloo"]["ScrollBar"]
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 06:51 PM
Don't you have the code for the script that adds gloo to _G?
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 06:52 PM
It's built in o:
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 06:53 PM
...it is? I thought _G was empty by default...
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
21 Jul 2013 06:55 PM
@Java,
It is not built in. You're talking about a script another user has made, which aids in the creation of GUIs (Gloo Library).

http://www.roblox.com/gloo-Library-v0-11-item?id=67401171

ROBLOX does have an inbuilt GUI library however, more information on this can be found at:
http://wiki.roblox.com/index.php/RbxLibrary
http://wiki.roblox.com/index.php/RbxGui_(Library)
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
21 Jul 2013 06:55 PM
> for k,v in pairs(_G.gloo) do print(k,v) end
ScrollingList function: 155D3698
Stylist function: 15C0D998
Graphic function: 155D3558
TruncatingLabel function: 155D1B40
ScrollingContainer function: 155D36E8
AutoSizeLabel function: 15D13C30
SetZIndex function: 155D3440
Help function: 15D13CB0
DockContainer function: 155D1B68
DetailedList function: 15C73130
GetPadding function: 15D13BF0
Sprite function: 15D13C10
StackingFrame function: 155D3648
SetZIndexOnChanged function: 15D13BB0
TabContainer function: 15C0E388
ScrollBar function: 15C0E358
Version function: 15D13B10
SORT table: 15D57970
GetScreen function: 15D13BD0


Errr, anyone know how to get the code?
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 06:55 PM
Nope, _G.gloo is the only thing in there, it's new and awesome o:
Just hard to use the ScrollBar function lol
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
21 Jul 2013 06:57 PM
Thanks @Desp.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 06:58 PM
Roblox has been messing with my Roblox! How dare they D:<
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 06:59 PM
So that sneaky Anaminus guy snuck that gloo in there? O:
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
21 Jul 2013 06:59 PM
@Java,
There's no global table named 'Gloo'... Again, I'll state it's a usermade script or I'm going bonkers.

00:53:54.023 - _G.gloo.Help():1: attempt to index field 'gloo' (a nil value)
00:53:54.024 - Script "_G.gloo.Help()", Line 1
00:53:54.024 - stack end

Happy?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 07:01 PM
Oh. Good
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
21 Jul 2013 07:01 PM
@Desperian, it was already there for me...?
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 07:01 PM
@Desp I was already typing that before you replied, but thank you.
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 07:03 PM
local function CreateScrollBar(horizontal,size)
size = size or ENTRY_SIZE

-- create row scroll bar
local ScrollFrame = Create'Frame'{
Size = horizontal and UDim2.new(1,0,0,size) or UDim2.new(0,size,1,0);
Position = horizontal and UDim2.new(0,0,1,-size) or UDim2.new(1,-size,0,0);
BackgroundTransparency = 1;
Name = "ScrollFrame";
Create'ImageButton'{
BackgroundColor3 = Color3.new(1,1,1);
BackgroundTransparency = 0.7;
BorderSizePixel = 0;
Size = UDim2.new(0, size, 0, size);
Name = "ScrollDown";
Position = horizontal and UDim2.new(1,-size,0,0) or UDim2.new(0,0,1,-size);
};
Create'ImageButton'{
BackgroundColor3 = Color3.new(1,1,1);
BackgroundTransparency = 0.7;
BorderSizePixel = 0;
Size = UDim2.new(0, size, 0, size);
Name = "ScrollUp";
};
Create'ImageButton'{
AutoButtonColor = false;
Size = horizontal and UDim2.new(1,-size*2,1,0) or UDim2.new(1,0,1,-size*2);
BackgroundColor3 = Color3.new(0,0,0);
BorderSizePixel = 0;
BackgroundTransparency = 0.7;
Position = horizontal and UDim2.new(0,size,0,0) or UDim2.new(0,0,0,size);
Name = "ScrollBar";
Create'ImageButton'{
BorderSizePixel = 0;
BackgroundColor3 = Color3.new(1,1,1);
Size = UDim2.new(0, size, 0, size);
BackgroundTransparency = 0.5;
Name = "ScrollThumb";
};
};
}

local ScrollDownFrame = ScrollFrame.ScrollDown
local ScrollDownGraphic = CreateGraphic(horizontal and "arrow-right" or "arrow-down",Vector2.new(size,size))
ScrollDownGraphic.GUI.Parent = ScrollDownFrame
local ScrollUpFrame = ScrollFrame.ScrollUp
local ScrollUpGraphic = CreateGraphic(horizontal and "arrow-left" or "arrow-up",Vector2.new(size,size))
ScrollUpGraphic.GUI.Parent = ScrollUpFrame
local ScrollBarFrame = ScrollFrame.ScrollBar
local ScrollThumbFrame = ScrollBarFrame.ScrollThumb
local Decal = CreateGraphic(horizontal and "vgrip" or "grip",Vector2.new(4),{BackgroundColor3=Color3.new(0,0,0),BackgroundTransparency=0.5})
Decal.GUI.Position = UDim2.new(0.5,-4,0.5,-4)
Decal.GUI.Parent = ScrollThumbFrame

local MouseDrag = Create'ImageButton'{
Active = false;
Size = UDim2.new(1.5, 0, 1.5, 0);
AutoButtonColor = false;
BackgroundTransparency = 1;
Name = "MouseDrag";
Position = UDim2.new(-0.25, 0, -0.25, 0);
ZIndex = 10;
}

local Class = {
GUI = ScrollFrame;
ScrollIndex = 0;
VisibleSpace = 0;
TotalSpace = 0;
PageIncrement = 1;
}

local function GetScrollPercent()
return Class.ScrollIndex/(Class.TotalSpace-Class.VisibleSpace)
end
Class.GetScrollPercent = GetScrollPercent

local function CanScrollDown()
return Class.ScrollIndex + Class.VisibleSpace < Class.TotalSpace
end
Class.CanScrollDown = CanScrollDown
Class.CanScrollRight = CanScrollDown

local function CanScrollUp()
return Class.ScrollIndex > 0
end
Class.CanScrollUp = CanScrollUp
Class.CanScrollLeft = CanScrollUp

local ScrollStyle = {BackgroundColor3=Color3.new(0,0,0),BackgroundTransparency=0}
local ScrollStyle_ds = {BackgroundColor3=Color3.new(0,0,0),BackgroundTransparency=0.7}

local last_down
local last_up
local UpdateScrollThumb = horizontal
and function()
ScrollThumbFrame.Size = UDim2.new(Class.VisibleSpace/Class.TotalSpace,0,0,size)
if ScrollThumbFrame.AbsoluteSize.x < size then
ScrollThumbFrame.Size = UDim2.new(0,size,0,size)
end
local bar_size = ScrollBarFrame.AbsoluteSize.x
ScrollThumbFrame.Position = UDim2.new(GetScrollPercent()*(bar_size - ScrollThumbFrame.AbsoluteSize.x)/bar_size,0,0,0)
end
or function()
ScrollThumbFrame.Size = UDim2.new(0,size,Class.VisibleSpace/Class.TotalSpace,0)
if ScrollThumbFrame.AbsoluteSize.y < size then
ScrollThumbFrame.Size = UDim2.new(0,size,0,size)
end
local bar_size = ScrollBarFrame.AbsoluteSize.y
ScrollThumbFrame.Position = UDim2.new(0,0,GetScrollPercent()*(bar_size - ScrollThumbFrame.AbsoluteSize.y)/bar_size,0)
end

local function Update()
local t = Class.TotalSpace
local v = Class.VisibleSpace
local s = Class.ScrollIndex
if v <= t then
if s > 0 then
if s + v > t then
Class.ScrollIndex = t - v
end
else
Class.ScrollIndex = 0
end
else
Class.ScrollIndex = 0
end

if Class.UpdateCallback then
if Class.UpdateCallback(Class) == false then
return
end
end

local down = CanScrollDown()
local up = CanScrollUp()
if down ~= last_down then
last_down = down
ScrollDownFrame.Active = down
ScrollDownFrame.AutoButtonColor = down
ScrollDownGraphic.Stylist.SetProperties(down and ScrollStyle or ScrollStyle_ds)
ScrollDownFrame.BackgroundTransparency = down and 0.5 or 0.7
end
if up ~= last_up then
last_up = up
ScrollUpFrame.Active = up
ScrollUpFrame.AutoButtonColor = up
ScrollUpGraphic.Stylist.SetProperties(up and ScrollStyle or ScrollStyle_ds)
ScrollUpFrame.BackgroundTransparency = up and 0.5 or 0.7
end
ScrollThumbFrame.Visible = down or up
UpdateScrollThumb()
end
Class.Update = Update

local function ScrollDown()
Class.ScrollIndex = Class.ScrollIndex + Class.PageIncrement
Update()
end
Class.ScrollDown = ScrollDown
Class.ScrollRight = ScrollDown

local function ScrollUp()
Class.ScrollIndex = Class.ScrollIndex - Class.PageIncrement
Update()
end
Class.ScrollUp = ScrollUp
Class.ScrollLeft = ScrollUp

local function ScrollTo(index)
Class.ScrollIndex = index
Update()
end
Class.ScrollTo = ScrollTo

local function SetScrollPercent(percent)
Class.ScrollIndex = math.floor((Class.TotalSpace - Class.VisibleSpace)*percent + 0.5)
Update()
end
Class.SetScrollPercent = SetScrollPercent

-- fixes AutoButtonColor
local function ResetButtonColor(button)
local active = button.Active
button.Active = not active
button.Active = active
end

SetZIndexOnChanged(ScrollFrame)

local scroll_event_id = 0
ScrollDownFrame.MouseButton1Down:connect(function()
scroll_event_id = tick()
local current = scroll_event_id
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scroll_event_id = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollDownFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
ScrollDown()
wait(0.2) -- delay before auto scroll
while scroll_event_id == current do
ScrollDown()
if not CanScrollDown() then break end
wait()
end
end)

ScrollDownFrame.MouseButton1Up:connect(function()
scroll_event_id = tick()
end)

ScrollUpFrame.MouseButton1Down:connect(function()
scroll_event_id = tick()
local current = scroll_event_id
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scroll_event_id = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
ScrollUp()
wait(0.2)
while scroll_event_id == current do
ScrollUp()
if not CanScrollUp() then break end
wait()
end
end)

ScrollUpFrame.MouseButton1Up:connect(function()
scroll_event_id = tick()
end)

ScrollBarFrame.MouseButton1Down:connect(horizontal
and function(x,y)
scroll_event_id = tick()
local current = scroll_event_id
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scroll_event_id = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
if x > ScrollThumbFrame.AbsolutePosition.x then
ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait(0.2)
while scroll_event_id == current do
if x < ScrollThumbFrame.AbsolutePosition.x + ScrollThumbFrame.AbsoluteSize.x then break end
ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait()
end
else
ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait(0.2)
while scroll_event_id == current do
if x > ScrollThumbFrame.AbsolutePosition.x then break end
ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait()
end
end
end
or function(x,y)
scroll_event_id = tick()
local current = scroll_event_id
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scroll_event_id = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
if y > ScrollThumbFrame.AbsolutePosition.y then
ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait(0.2)
while scroll_event_id == current do
if y < ScrollThumbFrame.AbsolutePosition.y + ScrollThumbFrame.AbsoluteSize.y then break end
ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait()
end
else
ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait(0.2)
while scroll_event_id == current do
if y > ScrollThumbFrame.AbsolutePosition.y then break end
ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait()
end
end
end)

ScrollThumbFrame.MouseButton1Down:connect(horizontal
and function(x,y)
scroll_event_id = tick()
local mouse_offset = x - ScrollThumbFrame.AbsolutePosition.x
local drag_con
local up_con
drag_con = MouseDrag.MouseMoved:connect(function(x,y)
local bar_abs_pos = ScrollBarFrame.AbsolutePosition.x
local bar_drag = ScrollBarFrame.AbsoluteSize.x - ScrollThumbFrame.AbsoluteSize.x
local bar_abs_one = bar_abs_pos + bar_drag
x = x - mouse_offset
x = x < bar_abs_pos and bar_abs_pos or x > bar_abs_one and bar_abs_one or x
x = x - bar_abs_pos
SetScrollPercent(x/(bar_drag))
end)
up_con = MouseDrag.MouseButton1Up:connect(function()
scroll_event_id = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollThumbFrame)
drag_con:disconnect(); drag_con = nil
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
end
or function(x,y)
scroll_event_id = tick()
local mouse_offset = y - ScrollThumbFrame.AbsolutePosition.y
local drag_con
local up_con
drag_con = MouseDrag.MouseMoved:connect(function(x,y)
local bar_abs_pos = ScrollBarFrame.AbsolutePosition.y
local bar_drag = ScrollBarFrame.AbsoluteSize.y - ScrollThumbFrame.AbsoluteSize.y
local bar_abs_one = bar_abs_pos + bar_drag
y = y - mouse_offset
y = y < bar_abs_pos and bar_abs_pos or y > bar_abs_one and bar_abs_one or y
y = y - bar_abs_pos
SetScrollPercent(y/(bar_drag))
end)
up_con = MouseDrag.MouseButton1Up:connect(function()
scroll_event_id = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollThumbFrame)
drag_con:disconnect(); drag_con = nil
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
end)

Update()

return Class,ScrollFrame
end

lib.ScrollBar = CreateScrollBar

That's.. a long function.. o.o
Help figuring out the answer to my question maybe?
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
21 Jul 2013 07:11 PM
There's instructions above it...?

doc["ScrollBar"] = [==[
ScrollBar ( bool `horizontal`, number `size` ) [constructor]
    returns: ScrollBar `object`, Frame `scroll_bar`

Creates a primative scroll bar.
This scroll bar features a draggable thumb, paging buttons at either end, and a clickable track.

Arguments:
    `horizontal`
        If true, the scroll bar will appear horizontally instead of vertically.
        Optional; defaults to false.
    `size`
        Sets the width or height of the scroll bar.
        Optional; defaults to ]==]..ENTRY_SIZE..[==[

Returns:
    `object`
        The ScrollBar object.
        
    `scroll_bar`
        The scroll bar GUI.


ScrollBar Class:
    This class contains the following members:

    Readonly:
        GUI
            The scroll bar itself.

    Fields:
        ScrollIndex
            A number indicating the current position of the scroll bar.

        TotalSpace
            A number indicating the total span of the scrollable space.

        VisibleSpace
            A number indicating the visible span of the scrollable space.

        PageIncrement
            The amount to increase or decrease the ScrollIndex when ScrollDown or ScrollUp is called.

    Methods:
        Update ( )
            Updates the scroll bar to reflect any changes.

        CanScrollDown ( )
            Returns whether the scroll bar can scroll down (or right if `horizontal` is true).

        CanScrollRight ( )
            Alias of CanScrollDown.

        CanScrollUp ( )
            Returns whether the scroll bar can scroll up (or left if `horizontal` is true).

        CanScrollLeft ( )
            Alias of CanScrollUp.

        ScrollDown ( )
            Scrolls down (or right) by the current PageIncrement.

        ScrollRight( )
            Alias of ScrollDown.

        ScrollUp ( )
            Scrolls up (or left) by the current PageIncrement.

        ScrollLeft ( )
            Alias of ScrollUp.

        ScrollTo ( number `index` )
            Scrolls to a specific place, specified by `index`.
            This may be any number; it will be clamped between 0 and TotalSpace.

        GetScrollPercent ( )
            Returns the scroll index as a percentage between 0 and 1.
            
        SetScrollPercent ( number `percent` )
            Sets the ScrollIndex as a percentage between 0 and 1.

        Destroy ( )
            Releases the resources used by this object.
            Run this if you're no longer using this object.

    Callbacks:
        UpdateCallback ( table `object` )
            When Update is called, the function is called before updating.
            If the function returns false, the update will be canceled.
]==]
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 07:13 PM
They don't tell me where to put the object I want to scroll through though. .-.
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
21 Jul 2013 08:04 PM
bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image