Version 1.18.2
Small change to DynamicTableModel.addRecord so that provided null
values are ignored. This effectively allows the callback provided via DynamicTableControl.setUserCanAddRecords to yield null
/nil
to cancel adding a record. The following example hopefully helps demonstrate this:
# Enable adding records
dynamic_table_control.setUserCanAddRecords(true) do
# Prompt user to select a file
key_file = CommonDialogs.openFileDialog("C:\\","Key File")
if !key_file.nil?
# If user selected a file, addtionally prompt user to enter a password
password = CommonDialogs.getInput("Password for #{key_file.getAbsolutePath}")
if !password.nil?
# If user provided both, yield a new record
next {key_file: key_file.getAbsolutePath, password: password}
end
end
# If we reached here, yield nil abort adding a new record
next nil
end