Torque3D Documentation / _generateds / GuiAutoScrollCtrl

GuiAutoScrollCtrl

consoledoc.h

A container that scrolls its child control up over time.

More...

Scrolling

Direction in which the child control is moved.

float

Seconds to wait before starting to scroll.

float

Seconds to wait after scrolling completes before resetting and starting over.

int

Padding to put around child control (in pixels).

float

Scrolling speed in pixels per second.

bool

If true, the scrolling will reset to the beginning once completing a cycle.

bool

If true, the child control will be completely scrolled out of sight; otherwise it will only scroll until the other end becomes visible.

Callbacks

void

Called every 32ms on the control.

void

Called when the control starts to scroll.

void

Called when the child control has been scrolled in entirety.

void

Called when the child control is reset to its initial position and the cycle starts again.

Public Functions

void

Reset scrolling.

Detailed Description

A container that scrolls its child control up over time.

This container can be used to scroll a single child control in either of the four directions.

// Create a GuiAutoScrollCtrl that scrolls a long text of credits.
new GuiAutoScrollCtrl( CreditsScroller )
{
   position = "0 0";
   extent = Canvas.extent.x SPC Canvas.extent.y;

   scrollDirection = "Up"; // Scroll upwards.
   startDelay = 4; // Wait 4 seconds before starting to scroll.
   isLooping = false; // Don't loop the credits.
   scrollOutOfSight = true; // Scroll up fully.

   new GuiMLTextCtrl()
   {
      text = $CREDITS;
   };
};

function CreditsScroller::onComplete( %this )
{
   // Switch back to main menu after credits have rolled.
   Canvas.setContent( MainMenu );
}

// Start rolling credits.
Canvas.setContent( CreditsScroller );

note:

Only the first child will be scrolled.

Scrolling

GuiAutoScrollDirection scrollDirection 

Direction in which the child control is moved.

float startDelay 

Seconds to wait before starting to scroll.

float resetDelay 

Seconds to wait after scrolling completes before resetting and starting over.

note:

Only takes effect if isLooping is true.

int childBorder 

Padding to put around child control (in pixels).

float scrollSpeed 

Scrolling speed in pixels per second.

bool isLooping 

If true, the scrolling will reset to the beginning once completing a cycle.

bool scrollOutOfSight 

If true, the child control will be completely scrolled out of sight; otherwise it will only scroll until the other end becomes visible.

Callbacks

onTick()

Called every 32ms on the control.

onStart()

Called when the control starts to scroll.

onComplete()

Called when the child control has been scrolled in entirety.

onReset()

Called when the child control is reset to its initial position and the cycle starts again.

Public Functions

reset()

Reset scrolling.