Running txt add hor

From Sim Innovations Wiki
Jump to navigation Jump to search


running_txt_id = running_txt_add_hor(x,y,nr_visible_items,item_width,item_height,value_callback,style)

running_txt_add_hor is used to add a running text object. Running text can be used to make multiple text objects scrollable horizontally.

Return value

Argument Type Description
running_txt_id ID This value can be used for further reference. Functions such as running_txt_move_carot can use this running_txt_id. Its good practice to store this running_txt_id in your logic code.


# Argument Type Description
1 x Number This is the most left point of the canvas where your running text should be shown.
2 y Number This is the most top point of the canvas where your running text should be shown.
3 nr_visible_items Number Number of text items that should be shown.
4 item_width Number The width of every text object in pixels.
5 item_height Number The height of every text object in pixels.
6 value_callback Function Callback function which will ask for the text that should be shown.
7 style String or Function The style to use.


function value_callback(item_nr)
  return "this is item " .. item_nr

-- This will generate 7 text_objects horizontally. Text objects are 200x100.
my_running_txt_id = running_txt_add_hor(100,100,7,200,100,value_callback,"size:11; color: white;")

-- Set carot to 1
running_txt_move_carot(my_running_txt_id, 1)

-- Or to 2...
running_txt_move_carot(my_running_txt_id, 2)