- Joined
- 9 Apr 2012
- Posts
- 13,159
So I'm forced to use Delphi for this project and I need some help 
Essentially the user enters coefficients for a constant all the way up to a sextic. These coefficients are validated using a regular expression and if they are valid, then they are converted using StrToFloat.
There is one form (GetFunction) where the user enters the coefficients and on clicking okay, if the coefficients are all valid (out of those which are enabled - done using checkboxes), then the graph is created on the second form (GraphingMode).
The issue I am having is keeping the GetFunction form visible until valid input is received. Currently I have it setup like this:
I am having to use the Exit command which I'm told is a bad idea as it makes the program less structured than it could be.
How do I do this then without using Exit?

Essentially the user enters coefficients for a constant all the way up to a sextic. These coefficients are validated using a regular expression and if they are valid, then they are converted using StrToFloat.
There is one form (GetFunction) where the user enters the coefficients and on clicking okay, if the coefficients are all valid (out of those which are enabled - done using checkboxes), then the graph is created on the second form (GraphingMode).
The issue I am having is keeping the GetFunction form visible until valid input is received. Currently I have it setup like this:
Code:
procedure TfrmGetFunction.btnAddFunctionClick(Sender: TObject);
var
i : integer; // Loop counter.
begin
for i := 1 to 7 do
begin
CoefficientEdit[i].CoValid := CheckCoefficientBoxesValidInput(CoefficientEdit[i].CoEditBox);
if not CoefficientEdit[i].CoValid then // If any input box is invalid.
Exit;
end;
frmGraphingMode.CreateGraph(1.001); // Finally if all input boxes valid.
frmGetFunction.Visible := false;
frmGraphingMode.Visible := true;
end;
I am having to use the Exit command which I'm told is a bad idea as it makes the program less structured than it could be.
How do I do this then without using Exit?