Auto Scrolling Container Control for TGEA
by Manuel Ruiz dupont · 08/27/2007 (1:45 pm) · 0 comments
Download Code File
Description
The auto scroll container control (GuiAutoScrollCtrl) is similar to the scroll container control in Torque (GuiScrollCtlr) in that you can place into it a child control larger than the container itself, and the container will scroll to show the entire child control. How GuiAutoScrollCtrl differs, though, is that it contains no scrollbars. Instead you specify a scrolling direction and speed, and the control automatically scrolls for you.
This control can be especially useful for displaying a scrolling screen of credits or a scrolling information ticker.
Installation Instructions
1) Place the guiAutoScrollCtrl.cc/guiAutoScrollCtrl.h files, and optionally the guiStaticMLTextCtrl.cc/guiStaticMLTextCtrl.h files, in the proper folders as described below, include them in your project, and recompile Torque.
File placement for TGE 1.4
Place the guiAutoScrollCtrl.cc/guiAutoScrollCtrl.h files in the TGE 1.4 directory of the zip file in the engine\gui\containers folder. Two optional files that you can also install are guiStaticMLTextCtrl.cc/guiStaticMLTextCtrl.h, which just implement a static (non interactive) version of the guiMLTextCtrl to ensure users can't highlight scrolling text (useful in a credits dialog). If you decide to install these two optional files, they should be placed in the engine\gui\controls folder.
File placement for TGE 1.3
Place the guiAutoScrollCtrl.cc/guiAutoScrollCtrl.h files in the TGE 1.3 directory of the zip file in the engine\gui folder. Two optional files that you can also install are guiStaticMLTextCtrl.cc/guiStaticMLTextCtrl.h, which just implement a static (non interactive) version of the guiMLTextCtrl to ensure users can't highlight scrolling text (useful in a credits dialog). If you decide to install these two optional files, they should also be placed in the engine\gui folder.
2) Add a new control profile for the GuiAutoScrollCtrl class in your client\ui\customProfile.cs file:
new GuiControlProfile (GuiAutoScrollProfile)
{
opaque = true;
fillColor = "255 255 255";
border = 3;
borderThickness = 2;
borderColor = "0 0 0";
bitmap = "./demoScroll";
hasBitmapArray = true;
};
3) Simply add a GuiAutoScrollCtrl control to your GUI via the GUI editor and place your text, bitmap, or any other control inside and watch it scroll.
Features of GuiAutoScrollCtrl
* Ability to specify scrolling interval (in milliseconds)
* Ability to specify scrolling delta (number of pixels to scroll) at each interval
* Ability to scroll in any direction (up, down, left, right, or diagnal)
* Ability to scroll once or repeat scrolling infinately
* Ability to turn scrolling on/off
Note that all features can be set automatically from within the GUI editor or dynamically via script.
Supported TorqueScript GuiAutoScrollCtrl Functions
void enableScrolling(true/false);
void enableHorizontalScrolling(true/false);
void enableVerticalScrolling(true/false);
bool isScrolling();
bool isScrolledToTop();
bool isScrolledToBottom();
bool isScrolledToLeftSide();
bool isScrolledToRightSide();
void setVerticalScrollDirection(0/1);
void setHorizontalScrollDirection(0/1);
void setScrollInterval(ms);
void setScrollDelta(pixels);
void repeatScroll(true/false);
void scrollToTop();
void scrollToBottom();
void scrollToLeftSide();
void scrollToRightSide();
void scrollTo(xpos, ypos);
Enjoy!
Description
The auto scroll container control (GuiAutoScrollCtrl) is similar to the scroll container control in Torque (GuiScrollCtlr) in that you can place into it a child control larger than the container itself, and the container will scroll to show the entire child control. How GuiAutoScrollCtrl differs, though, is that it contains no scrollbars. Instead you specify a scrolling direction and speed, and the control automatically scrolls for you.
This control can be especially useful for displaying a scrolling screen of credits or a scrolling information ticker.
Installation Instructions
1) Place the guiAutoScrollCtrl.cc/guiAutoScrollCtrl.h files, and optionally the guiStaticMLTextCtrl.cc/guiStaticMLTextCtrl.h files, in the proper folders as described below, include them in your project, and recompile Torque.
File placement for TGE 1.4
Place the guiAutoScrollCtrl.cc/guiAutoScrollCtrl.h files in the TGE 1.4 directory of the zip file in the engine\gui\containers folder. Two optional files that you can also install are guiStaticMLTextCtrl.cc/guiStaticMLTextCtrl.h, which just implement a static (non interactive) version of the guiMLTextCtrl to ensure users can't highlight scrolling text (useful in a credits dialog). If you decide to install these two optional files, they should be placed in the engine\gui\controls folder.
File placement for TGE 1.3
Place the guiAutoScrollCtrl.cc/guiAutoScrollCtrl.h files in the TGE 1.3 directory of the zip file in the engine\gui folder. Two optional files that you can also install are guiStaticMLTextCtrl.cc/guiStaticMLTextCtrl.h, which just implement a static (non interactive) version of the guiMLTextCtrl to ensure users can't highlight scrolling text (useful in a credits dialog). If you decide to install these two optional files, they should also be placed in the engine\gui folder.
2) Add a new control profile for the GuiAutoScrollCtrl class in your client\ui\customProfile.cs file:
new GuiControlProfile (GuiAutoScrollProfile)
{
opaque = true;
fillColor = "255 255 255";
border = 3;
borderThickness = 2;
borderColor = "0 0 0";
bitmap = "./demoScroll";
hasBitmapArray = true;
};
3) Simply add a GuiAutoScrollCtrl control to your GUI via the GUI editor and place your text, bitmap, or any other control inside and watch it scroll.
Features of GuiAutoScrollCtrl
* Ability to specify scrolling interval (in milliseconds)
* Ability to specify scrolling delta (number of pixels to scroll) at each interval
* Ability to scroll in any direction (up, down, left, right, or diagnal)
* Ability to scroll once or repeat scrolling infinately
* Ability to turn scrolling on/off
Note that all features can be set automatically from within the GUI editor or dynamically via script.
Supported TorqueScript GuiAutoScrollCtrl Functions
void enableScrolling(true/false);
void enableHorizontalScrolling(true/false);
void enableVerticalScrolling(true/false);
bool isScrolling();
bool isScrolledToTop();
bool isScrolledToBottom();
bool isScrolledToLeftSide();
bool isScrolledToRightSide();
void setVerticalScrollDirection(0/1);
void setHorizontalScrollDirection(0/1);
void setScrollInterval(ms);
void setScrollDelta(pixels);
void repeatScroll(true/false);
void scrollToTop();
void scrollToBottom();
void scrollToLeftSide();
void scrollToRightSide();
void scrollTo(xpos, ypos);
Enjoy!
