|
List Info
Thread: Dynamically codified a TNotifyEvent
|
|
| Dynamically codified a TNotifyEvent |

|
2006-04-03 06:59:45 |
|
Did you try to write
(Components[i] as TEdit).OnEnter:=SelectAll;
without the parameter
-----Original Message-----
From: delphi-en@yahoogroups.com [mailto:delphi-en@yahoogroups.com]On Behalf
Of Emmanuel Lamy
Sent: Sunday, April 02, 2006 8:13 PM
To: delphi-en@yahoogroups.com
Subject: [delphi-en] Dynamically codified a TNotifyEvent
Hello Everybody,
I am trying to dynamically attach a routine to a group of controls.
Let's say I have a multitude of Edit boxes on a form and I want
to "SelectAll" the content of each edit box "OnEnter", if the edit
box is not empty. I tried this:
...
for i:=0 to pred(ComponentCount) do
if Components[i] is TEdit then
(Components[i] as TEdit).OnEnter:=SelectAll((Components[i] as
TEdit));
...
procedure Tform1.SelectAll(aField: TEdit);
begin
if aField.Text <> '' then
aField.SelectAll;
end;
This approach generates an error when I compile the codes. I remain
convinced that there is an easier way other than coding the OnEnter
event of each individual Edit box. Can somebody, please, help? TIA.
Emmanuel
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: delphi-en-unsubscribe@yahoogroups.com
Yahoo! Groups Links
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|