Dear specialists here,
I would like to learn new techniques based on reactions of widget content changes. Does somebody of us have some free or opensource source which uses htmlwidgets unit? My goal is to learn where to add if then condition block, how to react on widgets changes.
Today I have found out, that simply adding if then condition which will monitor widget for text value do not work. It is not simply possible to add this condition block after last line related to GUI creation. I would had to monitor key presses or if there is An function or procedure to monitor input editable field for changes.
The similar problem is how to detect if somebody have clicked on specific button.
I do not want to overload MR Van Canneyt so much, because he is very busy. And eventhough he is very kind to Me, his patience can finish very soon. If I will learn how to react on widgets content changes, when I will learn how to react on button click, I will be very glad and I will not write so much E-mails to this mailing list like I Am writing for now. I have many positive emotions inside my soul. Because I could never create GUi so highly efficient like thanks to htmlwidgets unit. Because I do not have HTML tags on my memory, I like this unit very much. Because I can really create even complex forms and interactive WEB apps with no need to be sad, that I do not see at all and that I do not know, which number value should I add to The some command to put object on The screen correctly. Code is even very fast and screen readers friendly. So I AM feeling like in haven.
Thank you for some source codes. You can also write Me personally some short part of code for demonstration purposes. Important is, that it must be code which uses htmlwidgets unit. No code which cooperate with The previously created HTMl page by you.
Thank you very very much.
Mailing lists / pas2js / 2020-08
htmlwidgets based source codes plea
3 messages · 2 people ·
- MMgr. Janusz Chmiel 2
- MMichael Van Canneyt 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Mgr. Janusz Chmiel wrote 12 lines
Dear specialists here,
I would like to learn new techniques based on reactions of widget
content changes. Does somebody of us have some free or opensource source
which uses htmlwidgets unit? My goal is to learn where to add if then
condition block, how to react on widgets changes.
Today I have found out, that simply adding if then condition which will
monitor widget for text value do not work. It is not simply possible to add
this condition block after last line related to GUI creation.
I would had to monitor key presses or if there is An function or procedure
to monitor input editable field for changes.
The similar problem is how to detect if somebody have clicked on specific
button.
The TWebWidget class has event handlers for all HTML event types. They work as in Delphi or Lazarus, except the signature is different.
So, simplified:
TMyClass = Class(TComponent)
Frm : TWebPage;
Btn : TButtonWidget;
Procedure DoClick(Sender: TObject; Event: TJSEvent);
Procedure CreateButton;
end;
Procedure TMyClass.CreateButton;
begin
Frm:=TWebPage.Create(Self);
Btn:=TButtonWidget.Create(Self);
Btn.Parent:=Frm;
;
Btn.Text:='Click me';
Frm.Refresh;
end;
Procedure TMyClass.DoClick(Sender: TObject; aEvent : TJSEvent);
begin
window.alert('You clicked a button with text '+TButtonWidget(Sender).Text);
end;To monitor for changes in an input, the procedure is exactly the same, except the event is called OnChange.
Michael.
Thank you very much for yours amazing source code examples. I will do my code from scratch. I will test all on shorter examples to be 100 % sure what I will do. It is very good programmers technique which you have developed. Very well done and thank you again.
