Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2020-08

how to get text content from TTextInputWidget

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mgr. Janusz Chmiel

I have big plea. How to get content of TTextInputWidget? And where to put The instruction to get it? Should I type The code after last line which will refresh The whole page, so after last create widget on Page?

Or The code should be always added to The following block of code?

var
Application : TMyApplication;

Application:=TMyApplication.Create(nil);
Application.Initialize;
Application.Run;
end.
I AM very sorry, but long units are not easy for Me to analyse all functions and procedures on Then. Lazarus do not offer hot key to jump between procedures and functions. Sure, I can use CTRL+F and F3 key for repeated search. But it is not easy.
Thank you for yours advice. Thanks to yours unit, I Am more and more close to my goal. Sure, I will also recode my too long code, it will also save Javascriptinterpreter work.

Michael Van Canneyt
to Mgr. Janusz Chmiel
Mgr. Janusz Chmiel wrote
Please, tell Me The name of The function or procedure, which can get content from TTextInputWidget.

The "Value" property can be read or written.

Michael.

Mgr. Janusz Chmiel
to Mgr. Janusz Chmiel

I Am getting error:
Error: Can't access protected member Text
when I have declared on1 as string;
and when I type
on1:=o1.text;
o1 is The TTextInputWidget variable.
So how to get text correctly?

Michael Van Canneyt
to Mgr. Janusz Chmiel
Mgr. Janusz Chmiel wrote 7 lines
I Am getting error: Error: Can't access protected member Text when I have declared on1 as string; and when I type on1:=o1.text; o1 is The TTextInputWidget variable. So how to get text correctly?

As I said: The Value property contains the text (or value) of the edit. So:

on1:=o1.value;

Michael.

Jean SUZINEAU
to Mgr. Janusz Chmiel: I Am getting error: Error: Can't access protected member Text when I have declared on1 as…

Michael replied before me, I send my message anyway...

Le 29/08/2020 à 14:16, Mgr. Janusz Chmiel a écrit :

Show quoted text 11 lines
I Am getting error: Error: Can't access protected member Text when I have declared on1 as string; and when I type on1:=o1.text; o1 is The TTextInputWidget variable. So how to get text correctly? _______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js

I didn't try but according to the source   TCustomInputWidget.Text gives you the "inner text" of the input tag (the input widget is based on the "input" html tag).

TCustomInputWidget.Text is declared  as "protected" so it can only be accessed from the inside of the class definition.

It's not redefined in sub class TTextInputWidget which inherits from TCustomInputWidget so you can't access it.

A quick way to access it would be to declare your own subclass:

type
TMyTextInputWidget
=
  class(TTextInputWidget )
  published
    Property Text;
  end;

This way you'll be able to access the text property if you use TMyTextInputWidget  instead of TTextInputWidget . But I doubt it will be useful. I you use the html just below, you'll see what is the "value" and the "innertext" of the html tag. I think what you are searching for is the value, not the inner text of the tag.

<html>
  <body>
    <input value="value">innertext</input>
  </body>
</html>

Mgr. Janusz Chmiel
to Jean SUZINEAU

Yes, I need to know The value. So I have followed The advice from MR Van Canneyt.
But unfortunately for Me, I have got in other complex issues. How to make The condition block, if then begin end But it do not work. Very pbobably, I would had to have some code, which would be able to react on every input field change. if its content would be changed, condition block should be performed.
I have placed The condition block after FMyPage.Refresh; This is The last line which has something to do with GUi creation process. The question is. If code is able to monitor some variable when user is typing inside some input field, or if is it not possible. When I will learn how to react on widget text content changes and my condition blocks will work, it will be very important for Me.