CanInsObj Method

Build 1501 on 14/Nov/2017  This topic last edited on: 22/Mar/2016, at 17:07

Description

Returns true if it is possible to insert an element referencing object of the specified type in the article at the specified position.

Available in Ted and Fred.

Syntax

object.CanInsObj nIdx,strType

object

Required. Object name. Returned by Ted.GetActiveArticle, or Fred.GetActiveArticle, e.g. dim objarticle = Ted.GetActiveArticle or dim objarticle = Fred.GetActiveArticle.

nIdx

Insert position of the object, ranging from 0 = before the first element in the article to NTxts = after the last element in the article.

If it is not possible to insert objects of the specified type at this position the function fails with an error message.

If this parameter is negative, e.g. -1, the user is prompted to select an insertion position amongst all the valid ones for an object of the specified type.

To get the idx of the current element, use GetCurTxtIdx.

strType

A string identifying the type of object to insert.

Example

This script displays TRUE if it's possible to insert an object of img type in the first position of the article, or FALSE if that is not possible.

If Ted.HasActiveArticle Then

 dim objArticle = Ted.GetActiveArticle

 msgbox (objArticle.CanInsObj(1,"image"))

End If

Context

Article object

See also

GetRefObj, HasRefObj, InsObj, InsObjDlg