LazStats: Simple input validation of "Brown-Forsythe test for homogeneity of variance" in MainUnit. Avoid ultra-wide input box dialogs.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7379 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-04-13 20:57:36 +00:00
parent e88e7b1454
commit fd0dd2bac7

View File

@ -1252,6 +1252,9 @@ end; }
procedure TOS3MainFrm.FormCreate(Sender: TObject); procedure TOS3MainFrm.FormCreate(Sender: TObject);
begin begin
// Reduce ultra-wide width of Inputbox windows
cInputQueryEditSizePercents := 0;
if DictionaryFrm = nil then if DictionaryFrm = nil then
Application.CreateForm(TDictionaryFrm, DictionaryFrm); Application.CreateForm(TDictionaryFrm, DictionaryFrm);
@ -1652,14 +1655,30 @@ end;
procedure TOS3MainFrm.homotestClick(Sender: TObject); procedure TOS3MainFrm.homotestClick(Sender: TObject);
Var Var
response: string; response: string;
GroupCol, VarColumn,NoCases : integer; GroupCol, VarCol, NoCases: integer;
begin begin
response := InputBox('Column no. of group codes:','Column?','1'); response := '1';
GroupCol := StrToInt(response); repeat
response := InputBox('Column no. of dependent variable:','Column','2'); if not InputQuery('Column of group codes', 'Column index', response) then
VarColumn := StrToInt(response); exit;
if TryStrToInt(response, GroupCol) and (GroupCol > 0) then
break
else
MessageDlg('Illegal value entered for index of group column.', mtError, [mbOk], 0);
until false;
response := '2';
repeat
if not InputQuery('Column of dependent variable', 'Column index', response) then
exit;
if TryStrToInt(response, VarCol) then
break
else
MessageDlg('Illegal value entered for index of variable column.', mtError, [mbOK], 0);
until false;
NoCases := StrToInt(NoCasesEdit.text); NoCases := StrToInt(NoCasesEdit.text);
HomogeneityTest(GroupCol, VarColumn, NoCases); HomogeneityTest(GroupCol, VarCol, NoCases);
end; end;
// Menu "Simulations" > "Hypergeometric probability" // Menu "Simulations" > "Hypergeometric probability"