Running txt add cir

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

running_txt_id = running_txt_add_cir(x,y,nr_visible_items,item_width,item_height,radius,value_callback,style)
running_txt_id = running_txt_add_cir(x,y,nr_visible_items,item_width,item_height,radius_x,radius_y,value_callback,style)

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

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.

Arguments

# 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 radius_x Number The horizontal radius from the middle of the circle in pixels.
7 radius_y Number (Optional) The vertical radius from the middle of the circle in pixels. When not present, radius_x is used.
8 value_callback Function Callback function which will ask for the text that should be shown.
9 style String or Function The style to use. More information on styles.

Example

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

-- This will generate 7 text_objects horizontally. Text objects are 200x100. Radius of the circle is 350.
my_running_txt_id = running_txt_add_cir(100,100,7,200,100,350, value_callback,"-fx-font-size:11pt; -fx-fill: 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)