# The following code demonstrates how to edit a component's custom property after you right clicked the component.
# This code makes use of functions in order to edit the components custom properties.
# The following code should be located in the mouse released event handler.
# Also, there must be custom properties present on the component in order to handle these functions.
# For example, there must be a custom property called 'DatabaseProvider' that takes a string.
if event.button != event.BUTTON1:
def editDatabaseProvider(event):
result = system.gui.inputBox("Database Provider",event.source.parent.DatabaseProvider)
event.source.parent.DatabaseProvider = result
def editTable(event):
result = system.gui.inputBox("Table Name",event.source.parent.Table)
event.source.parent.Table = result
def editColumn(event):
result = system.gui.inputBox("Column Name",event.source.parent.Column)
event.source.parent.Column = result
def editKeyColumn(event):
result = system.gui.inputBox("Key Column Name",event.source.parent.KeyColumn)
event.source.parent.KeyColumn = result
names = ["Edit DB Provider", "Edit Table Name", "Edit Column Name", "Edit Key Column"]
functions = [editDatabaseProvider, editTable, editColumn, editKeyColumn]
menu = system.gui.createPopupMenu(names, functions)
menu.show(event) |