List Info

Thread: Lost Name property of custom component




Lost Name property of custom component
country flaguser name
Czech Republic
2007-08-16 16:17:41

DELPHI 5

PROBLEM
I have managed to lose the name property of my custom control?
IE:

if ActiveControl=MyControl then
print('This never gets executed even when ActiveControl is MyControl');

print(ActiveControl.Name); // this is blank

===

The control derives from TCustomControl, and does not muck/change with any
name properties.

In all other respects it poses not bugs or problems (can be named in the
IDE, manipulated in code etc).

I have written other controls and not run into this. Any ideas?

__._,_.___
.

__,_._,___
Re: Lost Name property of custom component
country flaguser name
United States
2007-08-17 09:05:20

steward%40manscat.com">stewardmanscat.com wrote:
> DELPHI 5
>
> PROBLEM
> I have managed to lose the name property of my custom control?
> IE:
>
> if ActiveControl=MyControl then
>; print('This never gets executed even when ActiveControl is MyControl');

How do you know?

How do you know that ActiveControl is MyControl if a conditional statement
fails, indicating that ActiveControl *isn't* MyControl?

Where are those two identifiers declared? (Ctrl+Click on them; don't
assume you know where they're declared.) Where do they get assigned?

Can you write a minimal program that reproduces the error, and then post
the code here?

> print(ActiveControl.Name); // this is blank

What do you expect it to print instead?

> The control derives from TCustomControl, and does not muck/change with any
> name properties.

If you're not changing the Name property, then it will always have its
default empty value. It's the IDE that names your components when you drop
them in the designer. Merely creating an instance doesn't give it a name.
The IDE-given names are restored when a form gets loaded.

--
Rob

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )