Txt-Name will collide

From Vectorlab
Jump to: navigation, search

Function to check if a proposed name will collide or not. Pass the environment where the check must be performed: layers or not. The name collision will only arise within these two environments. By Orso B. Schmid

{ Orso *********************************************** }
{ check if a name collision will arise by a proposed name }
{ a name collision will arise separately for names not unique among layers or among the rest , but you can have a layer and a class (for example) identically named without name collision to arise }
{ GetObject first searches the name list then, if nothing is found, searches the layer list, so GetObject is not apt alone to check for eventual name collsion }
FUNCTION T_NameWillCollide(checkLayerList: BOOLEAN; proposedName: STRING): BOOLEAN;
		h : HANDLE;
		T_NameWillCollide := FALSE;
		{ check layer list }
		IF checkLayerList THEN
			T_NameWillCollide := (GetLayerByName(proposedName) <> NIL)
		{ checks name list }
			h := GetObject(proposedName);
			IF h <> NIL THEN
				T_NameWillCollide := (GetType(h) <> 31);