Han-Get Symbol Folder

From Vectorlab
Jump to: navigation, search


Returns a handle to the parent folder of a symbol definition or a symbol instance on drawing, if any. By Orso B. Schmid


{ Orso *********************************************** }
{ gets the container folder of a symbol definition or of a symbol instance on drawing, if any }
FUNCTION H_SymFolder(symH : HANDLE; VAR symFolderName: STRING): HANDLE;
	VAR	
		symFolderH : HANDLE;
	BEGIN
		symFolderName := ''; { the var will always reset }
		H_SymFolder := NIL;
		
		IF symH <> NIL THEN BEGIN
			CASE GetType(symH) OF
			{ sym in doc }
			15:	symFolderH := GetParent(GetObject(GetSDName(GetObject(GetSymName(symH)))));
			
			{ sym definition, sym folder }
			16, 92:	symFolderH := GetParent(symH);
			END;
			
			IF (symFolderH <> NIL) & (GetType(symFolderH)= 92) THEN
				symFolderName := GetName(symFolderH);
		END;
		
		H_SymFolder := symFolderH;
	END;