Item font size in item dropdown - Vision

That makes sense. In that case, there are at least two options: you can use my Searchable Dropdown template from the exchange which has a table mode and a built in option to change the font size of the dropdown table, or you can hack the regular dropdown's table and change its font with scripting.

With the Ignition Exchange: Searchable Dropdown option, set the fontFixedSizeEnabled property to true, and set the fontFixedSize property to whatever the desired dropdown font size is. This will override the default font scaling and use the only the specified font size:
image

Result:
image

This option also has properties for customizing the various foreground and background colors of the dropdown independently of each other.

To hack the internal table of a regular dropdown component, the table can be obtained from the popup and manipulated directly. Here is a script I adapted from something I previously developed for programmatically setting the column widths of a dropdown:

# Run only once at initialization if the display mode is set to table [0 = list, 1 = table]
# Will not run in the designer unless preview mode is already running before the window is opened
if event.propertyName == 'componentRunning' and event.source.mode:
	
	# Recursively search the popup's subcomponents, locate the table and return it
	def getTable(popup):
		for component in popup.components:
			if 'JTable' in component.__class__.__name__:
				return component
			elif getTable(component):
				return getTable(component)
	
	# Retrieve the popup from the ui, locate the internal table and set its font to the dropdown's font
	dropdown = event.source
	ui = dropdown.UI
	for child in range(ui.getAccessibleChildrenCount(dropdown)):
		popup = ui.getAccessibleChild(dropdown, child)
		if 'TableComboBoxPopup' in popup.__class__.__name__:
			table = getTable(popup)
			table.font = dropdown.font
			break

image

Result:
image

2 Likes