I have a screen with 2 buttons and I want to capture the value that a user enters in the form as I could if I had an Edit.Text, how do I do it?
For example here if it works:
procedure Button1Click(Sender: TObject);
begin
if (Edit1.Text <> '') then
begin
VCASO:=Edit1.Text;
Self.Close;
end
else
showmessage ('No puede dejar el campo vacío.');
end;
But that only takes one line, I want a TMemo because it captures several lines, I appreciate your help.
Update:
This is what I have:
{$FORM TCasos, Ficha de Casos.sfm}
uses
Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
procedure Button1Click(Sender: TObject);
begin
if (Memo1.Text <> '') then
begin
VCASO:=Memo1.Text;
Self.Close;
end
else
showmessage ('No puede dejar el campo vacío.');
end;
procedure Button2Click(Sender: TObject);
begin
Self.Close;
end;
begin
end;
With the Text property of the TMemo component you can access its content, verify the uses and that it is correctly declared within the type block.
PS: Do the example in delphi 10.2.3
You can read the content of the Memo using its property
Lines
, which is aTStrings
. That is, you can access it line by line (itStrings
is the default property ) or the full text –including end-of-line characters– through its propertyText
.For example: