#......... #:............ # Other code above here which creates the parent window which includes a submit button... #:............ #......... # Create a Gtk2::MessageDialog to show Errors/Warnigns in: my $dialog_msgString = ""; my $msg_dialog = Gtk2::MessageDialog->new_with_markup($window, 'modal', 'warning', 'ok', $dialog_msgString); $msg_dialog->signal_connect (response => sub { my ($self, $response) = @_; if ($response eq 'ok') { print "*YOU CLICKED OK\n\n"; $msg_dialog->destroy(); } }); ### This will get Executed when the 'clicked' signal is caught for the "$submit_button": sub submit_function() { my $endTime = $entry_field->get_text(); # If the endTime does NOT match the REGEX, then... if ($endTime !~ /^[0-9]{1,}$/i) { $msg_dialog->set_markup("Warning: The time you entered is incorrect, numbers only!"); $msg_dialog->run(); } } ### This will get Executed when the 'clicked' signal is # caught for the "$cancel_button": sub cancel_function() { print "\n\n\n${BOLD_RED}*YOU CLICKED THE 'CANCEL' BUTTON!!\n\t*EXITING NOW....${OFF}\n\n"; exit 101; } ### When control reaches here GTK will sleep and wait for X Events Gtk2->main; 0;