0

Ok Now I will send you my code
procedure TAnaform.TrnsferButton1Click(Sender: TObject);
var
i:integer;
begin

for i:=1 to 82 do
TLabel(DisplayForm.FindComponent('Label'+inttostr(i))).caption:=
TMemo(Anaform.FindComponent(('Memo'+inttostr(i)))).Lines[0];
DisplayForm.Show;
end;
But when I entered the '0' inside "lines" property of memo components in object inspector instead of "Memo1","Memo2" and others... the code is working truely. If I delete everything in lines of memo components(think as a "space" character), some text inside some memo components are going to labels in spaces and no values that I entered into the memo components in Anaform
Ok now I have another problem. the problem is hidden inside that code scope:procedure

TAnaform.FormKeyPress(Sender: TObject; var Key: Char);
var
a:string;
begin
a:='A';
for i:=1 to 82 do
begin
if a = TMemo(Anaform.FindComponent(('Memo'+inttostr(i)))).Lines[0]
begin
if (not (Key in )) then
begin
Key:=#0;
Beep;
end;
end;
end;

as you see above, I have 82 memo components in the form. and I have to enter alphanumeric characters instead of numeric characters inside some of memo components (its count may be 6 or 8). but I still dont understand why this code scobe doesnt work in my project working...Can you help me duoas pls?

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Duoas
0

Your reported errors don't have much to do with the code you are showing me (at least not as far as I can tell --please use [[I][/I]code[I][/I]] blocks when posting).

Are you using Delphi (a.k.a. CodeGear) or are you using FPC? If the former, then you should use the help that comes with Delphi --it is very extensive and provides a lot of examples and is very well cross-referenced. For example, if you look at TForm properties, you'll see there is an ActiveControl property which shows which control currently has focus. The TMemo component has both OnChange and OnKeyPress event handlers you can hook directly into each memo to guard against invalid keys instead of using the form's key preview.

If you are using FPC it still has a good deal of documentation, and you can get the Delphi help files from Borland's website to supplement it.

Also, google around for tutorials and other things related to what you are trying to accomplish. Usually they will help you consider how best to do it and what kinds of things you need to watch out for.

Sorry, I know this isn't exactly the kind of help you expected... alas.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.