Skip to content

Version 1.18.2

Compare
Choose a tag to compare
@JuicyDragon JuicyDragon released this 08 Aug 22:15
· 36 commits to master since this release

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