Disable add roster button in the roster management

Hello,

I am trying to disable the add roster button and delete roster button in the roster management component in vision (user are not supposed to add or delete rosters). how is that possible?

Thanks,

Are you allowing users to edit rosters? But not create or delete?

If they can’t edit it at all, you can just disable user management from project properties for their user level.

I don’t think you can disable add,delete but allow edit. So a workaround might be covering said button with an object so it can’t be seen or clicked.

The add and delete buttons aren’t available through scripting. The best you can do without creating your own component is to use the onCreateRoster and onDeleteRoster extension functions to disallow the action when the user presses the button, or like @andrews said, cover the buttons with something.

1 Like

you can add scripts in OnCreateRoster and onDeleteRoster

1 Like

Since this post was resurrected, and it looked like an interesting thing to try, I developed a script that accesses the roster adding, editing, and deleting buttons, so they can be directly disabled or made invisible:

# Run from the Roster Manager's propertyChange event handler only once at initialization
# In the designer, preview mode must be running when the window is opened for this event to occur
if event.propertyName == 'componentRunning':

	# This is a recursive function that simply finds the roster table and retrieves its buttons
	def getRosterButtons(rosterManager):
		for component in rosterManager.getComponents():
			if '$RosterTable' in component.__class__.__name__:
				return [subComponent for subComponent in component.getComponents() if 'JideButton' in subComponent.__class__.__name__]
			else:
				buttons = getRosterButtons(component)
				if buttons:
					return buttons
	
	# Get the roster buttons and unpack them into respective variables
	addRosterButton, editRosterButton, deleteRosterButton = getRosterButtons(event.source)
	
	# Disable the add roster button
	addRosterButton.enabled = False
	
	# The edit and delete buttons are automatically enabled whenever a roster is selected,
	# ...but they are not automatically made visible, so setting the visibility
	# ...to false effectively disables them
	editRosterButton.visible = False
	deleteRosterButton.visible = False

Result:
Before:
image

After:
image

2 Likes