namcit99
asked on
To effort control throught the value of variable. To run command from a string
Dear advisor !
i use D2005
i have a form about 20 edit controls. And a combobox to contain all of the name of edit controls. Example : edtmathpoint, edtphysicpoint, edtchemistrypont, edtLiteraturepoint ...
And after the user choice any value from combobox, that edit control should be focused (Setfocus)
The code from visual foxpro :
lc = 'Thisform' + '.' + 'txtpoint'
&lc..Setfocus
Please should me the command on Delphi
ASKER
your solution is right. But explain a while
findcomponet is a mothod. What is the oject using this method. I try : form2.findcomponent (but get error, form2 is the name of form)
What i ask is the name of oject has been running findcomponent
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Self is NOT right
The value of name property of Form is RIGHT. Example FormX
I am studying Delphi . So i feel confused
ASKER
When i use Self . Only var of Object like Tedit and Construtor like Create, CreateNew, CreateParent
??
>Self is NOT right
why do you think this?
self is allways present for the instance of the object which method is called,
it must not be declared elsewhere
you may discuss the difference of a variable/object reference and object-instance
it is possible to create objects without any variable/object reference like
with TFormX.Create(nil) do
show;
meikl ;-)
>Self is NOT right
why do you think this?
self is allways present for the instance of the object which method is called,
it must not be declared elsewhere
you may discuss the difference of a variable/object reference and object-instance
it is possible to create objects without any variable/object reference like
with TFormX.Create(nil) do
show;
meikl ;-)
but in earlier versions it should work like
var e : TEdit;
begin
e := findcomponent(combobox1.te
if assigned(e) then
e.SetFocus;
end;
meikl ;-)