Re: Objects added two times: problem o misunderstanding?
Posted: Wed Jun 15, 2011 10:07 am
Hi to everyone.
1) about name. I think it's a good thing to remove this syntax ":Name := " because can create a lot of problem; on the other hand A) we treat the name in the New method (see the automatic procedure), B) ":Name" take effect when we execute "End With", C) with preprocessor we can handle very easy:
it will be
or
2) in my opinion, we can add an array (childs) and use it when we add (AddData method) object to its parent, to havee this syntax:
So, when we use "__objAddData( Self, cObjname)" we can add the object we do the same to the array; with some functions we can test if exists a control with the given name ( and for this, take a look to problem 1)).
Unfortunately, I never could use the statement "__ObjDelData" because create me problem (I don't know why, but read harbour changelog); I always use <cObjectName>:= NIL. This statement clears the object, but don't remove object from its parent! With arrary, I remove the name et voilà: I can test its presence and recreate.
N.B. if we have a SuperParent, we can use the same method to control window: it's already defined, order creation and so on....
The last but not the least, we can get a list of childs:
P.S. perhaps we can also use aControls array.
IMHO, I don't know if it's a good future recreate an object with the same name: before "button1" was a button after will be a label: mmmmh!
Best regards
1) about name. I think it's a good thing to remove this syntax ":Name := " because can create a lot of problem; on the other hand A) we treat the name in the New method (see the automatic procedure), B) ":Name" take effect when we execute "End With", C) with preprocessor we can handle very easy:
Code: Select all
WITH OBJECT Button():New( cName )
Code: Select all
DEFINE BUTTON <ObjectName> ===> WITH OBJECT Button():New( ObjectName )
Code: Select all
DEFINE BUTTON <ObjectName> ===> WITH OBJECT <ObjectName> := Button():New( ObjectName )
Code: Select all
ParentControl:ChildControl:Value
Unfortunately, I never could use the statement "__ObjDelData" because create me problem (I don't know why, but read harbour changelog); I always use <cObjectName>:= NIL. This statement clears the object, but don't remove object from its parent! With arrary, I remove the name et voilà: I can test its presence and recreate.
N.B. if we have a SuperParent, we can use the same method to control window: it's already defined, order creation and so on....
The last but not the least, we can get a list of childs:
Code: Select all
METHOD ChildList INLINE aChilds
IMHO, I don't know if it's a good future recreate an object with the same name: before "button1" was a button after will be a label: mmmmh!
Best regards