Skip to content

Version 1.22.2

Latest

Choose a tag to compare

@JuicyDragon JuicyDragon released this 28 Jan 18:30

Added support for custom cell highlighting to DynamicTableControl:

# Fetch the native DynamicTable control by its identifier
dynamic_table_control = main_tab.getControl("characters_table")

# Customize highlighting such that negative values are highlighted RED when the character IS NOT a force user
dynamic_table_control.addCellHighlighter(Java::JavaAwt::Color::RED) do |cell_info|
	# cell_info is a DynamicTableControl.CellInfo instance, which contains various info we can make use of:
	cell_value = cell_info.value
	row = cell_info.row
	col = cell_info.column
	record = cell_info.rowRecord # In case you want to inspect other values in that row

	highlight_it = cell_value.is_a?(Integer) && cell_value <= 0
	next highlight_it
end

# Customize highlighting such that negative values are highlighted YELLOW when the character IS a force user
dynamic_table_control.addCellHighlighter(Java::JavaAwt::Color::YELLOW) do |cell_info|
	# cell_info is a DynamicTableControl.CellInfo instance, which contains various info we can make use of:
	cell_value = cell_info.value
	row = cell_info.row
	col = cell_info.column
	record = cell_info.rowRecord # In case you want to inspect other values in that row

	highlight_it = record[:hasForce] && cell_value.is_a?(Integer) && cell_value <= 0
	next highlight_it
end

Full example located in DynamicTableTest04.rb