Han-Get the right object

From Vectorlab
Jump to: navigation, search

GetObject will first parse the NameList then the LayerList. This subroutine makes half-way sure that you don't get the wrong object. You must distinguish betwee layers and not layers passing an object type. By Orso B. Schmid

{ Orso **************************************** }
{ GetObject distinguish between layer and name list objects }
FUNCTION H_GetObject(objType: INTEGER; objName: STRING): HANDLE;
		H_GetObject := NIL;
		IF Len(objName) > 0 THEN
			IF objType = 31 THEN
				H_GetObject := GetLayerByName(objName)
				H_GetObject := GetObject(objName); { this might still be a layer! }
Pay attention that if you pass an object index <> 31 (not a layer) but the name of the queried object has no correspondence in the Name List AND there is a layer with that name, GetObject will get you the layer.
This call is only interesting for you if you are processing a large block of names where you automatically pass object types and names. With it you won't bother to choose between {{{2}}} and {{{2}}}.