Event handler for calculate button.