[Pas2js] how many input fields can be created by using TTextInputWidget;

Mgr. Janusz Chmiel janusz.chmiel at volny.cz
Fri Aug 28 16:32:18 CEST 2020


Here is my repaired code, it has created all 36 input fields with no issues.
It even do not freeze when Javascript interpreter must create so many fields
and screen reader interprocess based communication is being intensively
using WEB browser too.
Thank you that you have constructed so profesionally optimized Javascript
code. Since I have bad experiences that some Javascript build in
interpreters in some browsers can freeze on some Javascript code.
My dream is to have routine, which would monitor all 36 input fields in The
background. If An field get right answer, routine could create new text to a
36 lines and 2 column table. So table would receive good answers. If user
will type nonsenses or bad answer, table will not get new words. The
question is, if is it technically possible to monitor The inputfield content
in The background by using for do or loop which would monitor all 36
inputfields variable. I Am aware, that such Javascript interpreter intensive
work can make key reaction on A focused input field slower when using it
with screen readers. But it is The onlyone possibility how to make this
project easily usable.
I do not want to force clients to fill out whole form and pressing evaluate
button. But I do not know, if real time checking is possible and if it will
not cause etreme big memory leak so browser processes could allocate 120 or
250 MB more of RAm while monitoring 36 input fields at The same time.

program project1;

{$mode objfpc}
uses
browserapp, JS, Classes, SysUtils, Web, webwidget, htmlwidgets;

type
TMyApplication=class(TBrowserApplication)
procedure doRun; override;
end;
procedure TMyApplication.doRun;
var
FMyPage: TWebPage;
FMyButton: TButtonWidget;
o1: TTextInputWidget;
o2: TTextInputWidget;
o3: TTextInputWidget;
o4: TTextInputWidget;
o5: TTextInputWidget;
o6: TTextInputWidget;
o7: TTextInputWidget;
o8: TTextInputWidget;
o9: TTextInputWidget;
o10: TTextInputWidget;
o11: TTextInputWidget;
o12: TTextInputWidget;
o13: TTextInputWidget;
o14: TTextInputWidget;
o15: TTextInputWidget;
o16: TTextInputWidget;
o17: TTextInputWidget;
o18: TTextInputWidget;
o19: TTextInputWidget;
o20: TTextInputWidget;
o21: TTextInputWidget;
o22: TTextInputWidget;
o23: TTextInputWidget;
o24: TTextInputWidget;
o25: TTextInputWidget;
o26: TTextInputWidget;
o27: TTextInputWidget;
o28: TTextInputWidget;
o29: TTextInputWidget;
o30: TTextInputWidget;
o31: TTextInputWidget;
o32: TTextInputWidget;
o33: TTextInputWidget;
o34: TTextInputWidget;
o35: TTextInputWidget;
o36: TTextInputWidget;
ol1: TLabelWidget;
ol2: TLabelWidget;
ol3: TLabelWidget;
ol4: TLabelWidget;
ol5: TLabelWidget;
ol6: TLabelWidget;
ol7: TLabelWidget;
ol8: TLabelWidget;
ol9: TLabelWidget;
ol10: TLabelWidget;
ol11: TLabelWidget;
ol12: TLabelWidget;
ol13: TLabelWidget;
ol14: TLabelWidget;
ol15: TLabelWidget;
ol16: TLabelWidget;
ol17: TLabelWidget;
ol18: TLabelWidget;
ol19: TLabelWidget;
ol20: TLabelWidget;
ol21: TLabelWidget;
ol22: TLabelWidget;
ol23: TLabelWidget;
ol24: TLabelWidget;
ol25: TLabelWidget;
ol26: TLabelWidget;
ol27: TLabelWidget;
ol28: TLabelWidget;
ol29: TLabelWidget;
ol30: TLabelWidget;
ol31: TLabelWidget;
ol32: TLabelWidget;
ol33: TLabelWidget;
ol34: TLabelWidget;
ol35: TLabelWidget;
ol36: TLabelWidget;
tex: TTextWidget ;
begin
       FMyPage:=TWebPage.Create(Self);
                    FMyPage.Parent:=TViewPort.Create(Nil);
tex:=TTextWidget.Create(Self);
tex.Parent:=FMyPage;
tex.Text:='Doplňte druhého do známé dvojice.';
       tex.Refresh;
o1:=TTextInputWidget .Create(Self);
ol1:=TLabelwidget.Create(Self);
ol1.Text:='Hamlet a';
ol1.LabelFor:=o1;
ol1.Parent:=FMyPage;
o1.Parent:=FMyPage;
ol1.refresh;
o1.Refresh;
o2:=TTextInputWidget .Create(Self);
ol2:=TLabelwidget.Create(Self);
ol2.Text:='Břetislav a';
ol2.LabelFor:=o2;
ol2.Parent:=FMyPage;
o2.Parent:=FMyPage;
ol2.refresh;
o2.Refresh;
o3:=TTextInputWidget .Create(Self);
ol3:=TLabelwidget.Create(Self);
ol3.Text:='Radúz a';
ol3.LabelFor:=o3;
ol3.Parent:=FMyPage;
o3.Parent:=FMyPage;
ol3.refresh;
o3.Refresh;
o4:=TTextInputWidget .Create(Self);
ol4:=TLabelwidget.Create(Self);
ol4.Text:='Laurin a';
ol4.LabelFor:=o4;
ol4.Parent:=FMyPage;
o4.Parent:=FMyPage;
ol4.refresh;
o4.Refresh;
o5:=TTextInputWidget .Create(Self);
ol5:=TLabelwidget.Create(Self);
ol5.Text:='Kain a';
ol5.LabelFor:=o5;
ol5.Parent:=FMyPage;
o5.Parent:=FMyPage;
ol5.refresh;
o5.Refresh;
o6:=TTextInputWidget .Create(Self);
ol6:=TLabelwidget.Create(Self);
ol6.Text:='Romeo a';
ol6.LabelFor:=o6;
ol6.Parent:=FMyPage;
o6.Parent:=FMyPage;
ol6.refresh;
o6.Refresh;
o7:=TTextInputWidget .Create(Self);
ol7:=TLabelwidget.Create(Self);
ol7.Text:='Othello a';
ol7.LabelFor:=o7;
ol7.Parent:=FMyPage;
o7.Parent:=FMyPage;
ol7.refresh;
o7.Refresh;
o8:=TTextInputWidget .Create(Self);
ol8:=TLabelwidget.Create(Self);
ol8.Text:='Přemysl a';
ol8.LabelFor:=o8;
ol8.Parent:=FMyPage;
o8.Parent:=FMyPage;
ol8.refresh;
o8.Refresh;
o9:=TTextInputWidget .Create(Self);
ol9:=TLabelwidget.Create(Self);
ol9.Text:='Kleopatra a';
ol9.LabelFor:=o9;
ol9.Parent:=FMyPage;
o9.Parent:=FMyPage;
ol9.refresh;
o9.Refresh;
o10:=TTextInputWidget .Create(Self);
ol10:=TLabelwidget.Create(Self);
ol10.Text:='Faust a';
ol10.LabelFor:=o10;
ol10.Parent:=FMyPage;
o10.Parent:=FMyPage;
ol10.refresh;
o10.Refresh;
o11:=TTextInputWidget .Create(Self);
ol11:=TLabelwidget.Create(Self);
ol11.Text:='Tristan a';
ol11.LabelFor:=o11;
ol11.Parent:=FMyPage;
o11.Parent:=FMyPage;
ol11.refresh;
o11.Refresh;
o12:=TTextInputWidget .Create(Self);
ol12:=TLabelwidget.Create(Self);
ol12.Text:='Adam a';
ol12.LabelFor:=o12;
ol12.Parent:=FMyPage;
o12.Parent:=FMyPage;
ol12.refresh;
o12.Refresh;
o13:=TTextInputWidget .Create(Self);
ol13:=TLabelwidget.Create(Self);
ol13.Text:='Cyrano a';
ol13.LabelFor:=o13;
ol13.Parent:=FMyPage;
o13.Parent:=FMyPage;
ol13.refresh;
o13.Refresh;
o14:=TTextInputWidget .Create(Self);
ol14:=TLabelwidget.Create(Self);
ol14.Text:='David a';
ol14.LabelFor:=o14;
ol14.Parent:=FMyPage;
o14.Parent:=FMyPage;
ol14.refresh;
o14.Refresh;
o15:=TTextInputWidget .Create(Self);
ol15:=TLabelwidget.Create(Self);
ol15.Text:='Oldřich a';
ol15.LabelFor:=o15;
ol15.Parent:=FMyPage;
o15.Parent:=FMyPage;
ol15.refresh;
o15.Refresh;
o16:=TTextInputWidget .Create(Self);
ol16:=TLabelwidget.Create(Self);
ol16.Text:='Ruslan a';
ol16.LabelFor:=o16;
ol16.Parent:=FMyPage;
o16.Parent:=FMyPage;
ol16.refresh;
o16.Refresh;
o17:=TTextInputWidget .Create(Self);
ol17:=TLabelwidget.Create(Self);
ol17.Text:='Kolben a';
ol17.LabelFor:=o17;
ol17.Parent:=FMyPage;
o17.Parent:=FMyPage;
ol17.refresh;
o17.Refresh;
o18:=TTextInputWidget .Create(Self);
ol18:=TLabelwidget.Create(Self);
ol18.Text:='Čert a';
ol18.LabelFor:=o18;
ol18.Parent:=FMyPage;
o18.Parent:=FMyPage;
ol18.refresh;
o18.Refresh;
o19:=TTextInputWidget .Create(Self);
ol19:=TLabelwidget.Create(Self);
ol19.Text:='Romulus a';
ol19.LabelFor:=o19;
ol19.Parent:=FMyPage;
o19.Parent:=FMyPage;
ol19.refresh;
o19.Refresh;
o20:=TTextInputWidget .Create(Self);
ol20:=TLabelwidget.Create(Self);
ol20.Text:='Hanzelka a';
ol20.LabelFor:=o20;
ol20.Parent:=FMyPage;
o20.Parent:=FMyPage;
ol20.refresh;
o20.Refresh;
o21:=TTextInputWidget .Create(Self);
ol21:=TLabelwidget.Create(Self);
ol21.Text:='Suchý a';
ol21.LabelFor:=o1;
ol21.Parent:=FMyPage;
o21.Parent:=FMyPage;
ol21.refresh;
o21.Refresh;
o22:=TTextInputWidget .Create(Self);
ol22:=TLabelwidget.Create(Self);
ol22.Text:='Šimek a';
ol22.LabelFor:=o22;
ol22.Parent:=FMyPage;
o22.Parent:=FMyPage;
ol22.refresh;
o22.Refresh;
o23:=TTextInputWidget .Create(Self);
ol23:=TLabelwidget.Create(Self);
ol23.Text:='Laurel a';
ol23.LabelFor:=o23;
ol23.Parent:=FMyPage;
o23.Parent:=FMyPage;
ol23.refresh;
o23.Refresh;
o24:=TTextInputWidget .Create(Self);
ol24:=TLabelwidget.Create(Self);
ol24.Text:='Voskovec a';
ol24.LabelFor:=o24;
ol24.Parent:=FMyPage;
o24.Parent:=FMyPage;
ol24.refresh;
o24.Refresh;
o25:=TTextInputWidget .Create(Self);
ol25:=TLabelwidget.Create(Self);
ol25.Text:='Křemílek a';
ol25.LabelFor:=o25;
ol25.Parent:=FMyPage;
o25.Parent:=FMyPage;
ol25.refresh;
o25.Refresh;
o26:=TTextInputWidget .Create(Self);
ol26:=TLabelwidget.Create(Self);
ol26.Text:='Maková panenka a';
ol26.LabelFor:=o26;
ol26.Parent:=FMyPage;
o26.Parent:=FMyPage;
ol26.refresh;
o26.Refresh;
o27:=TTextInputWidget .Create(Self);
ol27:=TLabelwidget.Create(Self);
ol27.Text:='Bob a';
ol27.LabelFor:=o27;
ol27.Parent:=FMyPage;
o27.Parent:=FMyPage;
ol27.refresh;
o27.Refresh;
o28:=TTextInputWidget .Create(Self);
ol28:=TLabelwidget.Create(Self);
ol28.Text:='Bolek a';
ol28.LabelFor:=o28;
ol28.Parent:=FMyPage;
o28.Parent:=FMyPage;
ol28.refresh;
o28.Refresh;
o29:=TTextInputWidget .Create(Self);
ol29:=TLabelwidget.Create(Self);
ol29.Text:='Čuk a';
ol29.LabelFor:=o29;
ol29.Parent:=FMyPage;
o29.Parent:=FMyPage;
ol29.refresh;
o29.Refresh;
o30:=TTextInputWidget .Create(Self);
ol30:=TLabelwidget.Create(Self);
ol30.Text:='Jeníček a';
ol30.LabelFor:=o30;
ol30.Parent:=FMyPage;
o30.Parent:=FMyPage;
ol30.refresh;
o30.Refresh;
o31:=TTextInputWidget .Create(Self);
ol31:=TLabelwidget.Create(Self);
ol31.Text:='Spejbl a';
ol31.LabelFor:=o31;
ol31.Parent:=FMyPage;
o31.Parent:=FMyPage;
ol31.refresh;
o31.Refresh;
o32:=TTextInputWidget .Create(Self);
ol32:=TLabelwidget.Create(Self);
ol32.Text:='Sultán a';
ol32.LabelFor:=o32;
ol32.Parent:=FMyPage;
o32.Parent:=FMyPage;
ol32.refresh;
o32.Refresh;
o33:=TTextInputWidget .Create(Self);
ol33:=TLabelwidget.Create(Self);
ol33.Text:='Orfeus a';
ol33.LabelFor:=o33;
ol33.Parent:=FMyPage;
o33.Parent:=FMyPage;
ol33.refresh;
o33.Refresh;
o34:=TTextInputWidget .Create(Self);
ol34:=TLabelwidget.Create(Self);
ol34.Text:='Ctirad a';
ol34.LabelFor:=o34;
ol34.Parent:=FMyPage;
o34.Parent:=FMyPage;
ol34.refresh;
o34.Refresh;
o35:=TTextInputWidget .Create(Self);
ol35:=TLabelwidget.Create(Self);
ol35.Text:='Samson a';
ol35.LabelFor:=o35;
ol35.Parent:=FMyPage;
o35.Parent:=FMyPage;
ol35.refresh;
o35.Refresh;
o36:=TTextInputWidget .Create(Self);
ol36:=TLabelwidget.Create(Self);
ol36.Text:='Cyril a';
ol36.LabelFor:=o36;
ol36.Parent:=FMyPage;
o36.Parent:=FMyPage;
ol36.refresh;
o36.Refresh;

FMyButton:=TButtonWidget.Create(Self);
FMyButton.Parent:=FMyPage;
FMyButton.Text:='vyhodnotit odpovědi';
FMyButton.Refresh;

FMyPage.Refresh;
end;

var
Application : TMyApplication;

begin
Application:=TMyApplication.Create(nil);
Application.Initialize;
Application.Run;
end.



More information about the Pas2js mailing list