Scrolling Functions
While scrolling a list is one of the more complex features of menus, this framework makes this very simple. Assuming you followed the advice in List Generation Functions, for the list itself adding scrolling to a menu becomes very simple.
Scroll Bar Tile
The scroll bars are generally provided by menus themselves via prefabs, for example:
<image name="scroll_bar">
<include src="vertical_scroll.xml"/>
<depth> 4 </depth>
<id> 112 </id>
<user1> 0 </user1>
<user2>
<copy src="list_rect" trait="child_count" />
<sub src="me()" trait="user8" />
<add> 2 </add>
</user2>
<user3> 1 </user3>
<user4> 6 </user4>
<user5> 0 </user5>
<user6> 33 </user6>
<user8> 8 </user8>
</image>
The user traits are integral to operating a scroll bar:
- user1:
Minimum amount of items to view
- user2:
Maximum scroll amount. This trait should be set to the child count of the list
rect. It’s pretty important to be specific with your own menu- user3:
Amount scroll bar moves when arrow of scroll bar is clicked
- user4:
Amount scroll bar moves when bar of scroll bar is clicked
- user5:
The scroll bar’s writable current position
- user6:
The ID of the scroll bar’s marker
- user7:
The scroll bar’s readable current position
- user8:
Number of items visible
GMFOnScrollVerticalInitFunction
Warning
This function is deprecated for the &Scroll; entity.
- Args:
@string::sTile,@array::aIDs- Info:
This function is intended to be called continuously, such as in a
begin menumode 1011loop in a quest script, to provide scrolling controls.sTileis the scroll bar tile, andaIDsis an array of numeric IDs that you wish this scrolling to affect.This function is for a vertical scroll bar.
GMFOnScrollHorizontalInitFunction
Warning
This function is deprecated for the &Scroll; entity.
- Args:
@string::sTile,@array::aIDs- Info:
This function is intended to be called continuously, such as in a
begin menumode 1011loop in a quest script, to provide scrolling controls.sTileis the scroll bar tile, andaIDsis an array of numeric IDs that you wish this scrolling to affect.This function is for a horizontal scroll bar.
GMFOnDragInitFunction
- Args:
@array::aTiles- Info:
This function intializes dragging of a number of scroll bars. Each index of
aTilesis a stringmap that contains only the 2 keys:tileandid. The tile should be the menu tile that contains the scroll bar, while the ID should be whatever ID you used for this tile. The default value for scroll bar IDs (i.e. if you are using a&Scroll;entity is 33.This function is designed to work continuously for either horizontal or vertical scroll bars. The behavior of the scroll bars is up to the user, set in code and XML.
Private Functions
Warning
These functions are private for a reason. The documentation here is purely for posterity. These functions should not be used in any circumstance. If you find potential use in any of these functions, please notify.
GMPFOnClickHoldDragHorizontalFunction
- Args:
@string::sTile,@string::sCurrComponent- Info:
When the user holds the left mouse button and is on a horizontal scroll bar, this function will get the height values of the scroll bar plus the marker and export them to the quest script
- Globals Exported:
@float::fGameX,@float::fSliderPos
GMPFOnClickHoldDragVerticalFunction
- Args:
@string::sTile,@string::sCurrComponent- Info:
When the user holds the left mouse button and is on a vertical scroll bar, this function will get the height values of the scroll bar plus the marker and export them to the quest script
- Globals Exported:
@float::fGameY,@float::fSliderPos
GMPFOnDragHorizontalFunction
- Args:
@string::sTile- Info:
When the user is holding the left mouse button and is on a scroll bar marker, this function will use the cursor’s X position and attempt to update the scroll bar to said position. This function relies on the left mouse button to be held, and dragging to be enabled by the scripting.
GMPFOnDragHorizontalFunction
- Args:
@string::sTile- Info:
When the user is holding the left mouse button and is on a scroll bar marker, this function will use the cursor’s Y position and attempt to update the scroll bar to said position. This function relies on the left mouse button to be held, and dragging to be enabled by the scripting.
GMPFOnDragMainFunction
- Args:
@string::sTile- Info:
When dragging is enabled, this function controls dragging direction.
GMPFOnHoldLeftMouseMainFunction
- Args:
@string::sTile- Info:
Starts dragging when the left mouse button is held, handles both directions.
GMPFOnScrollHorizontalLeftFunction
- Args:
@string::sTile- Info:
When a scroll left command is set, this function updates the scroll bar’s scroll value horizontally to the left.
GMPFOnScrollHorizontalRightFunction
- Args:
@string::sTile- Info:
When a scroll right command is set, this function updates the scroll bar’s scroll value horizontally to the right.
GMPFOnScrollVerticalUpFunction
- Args:
@string::sTile- Info:
When a scroll up command is set, this function updates the scroll bar’s scroll value vertically to the up.
GMPFOnScrollVerticalDownFunction
- Args:
@string::sTile- Info:
When a scroll down command is set, this function updates the scroll bar’s scroll value vertically to the down.