steve_hall
13 years agoContributor
Function Expected Error.... but only after a few calls!
Hi guys,
I have a function as pasted below. I have an array of objects that I pass in turn in calls to this function in a loop. The first few calls are absolutely fine, but then I get an error in the array loop, on the line that calls this function, saying "Function Expected" - well, it IS a function I'm calling, and the loop has already called it several times!
Can anyone suggest what I'm missing?!
Function:
function FindObjectCaption(TargetObject)
{
// FindObjectCaption = null;
if (aqString.Find(TargetObject.FullName, "d_browse", 0, false) > 0)
{
switch (TargetObject.ObjectType)
{
case "Edit":
case "Client":
// insert caption finder here for browsers
break;
case "Button":
FindObjectCaption = TargetObject.Caption
break;
}
}
else
{
switch (TargetObject.ObjectType)
{
case "Edit":
case "Client":
if (aqString.SubString(TargetObject.Caption, aqString.GetLength(TargetObject.Caption) - 2, 2) == "_t")
{
FindObjectCaption = TargetObject.Child(0).Caption + " Label";
}
else
{
var PropArray = Array ("Caption");
var ValArray = Array (TargetObject.Caption + "_t");
var LabelChildren = TargetObject.Parent.FindAllChildren(PropArray, ValArray, 1);
LabelChildren = (new VBArray(LabelChildren)).toArray();
if (LabelChildren.length > 0)
{
FindObjectCaption = LabelChildren[0].Caption;
}
}
break;
case "Button":
FindObjectCaption = TargetObject.Caption
break;
}
}
}
I have a function as pasted below. I have an array of objects that I pass in turn in calls to this function in a loop. The first few calls are absolutely fine, but then I get an error in the array loop, on the line that calls this function, saying "Function Expected" - well, it IS a function I'm calling, and the loop has already called it several times!
Can anyone suggest what I'm missing?!
Function:
function FindObjectCaption(TargetObject)
{
// FindObjectCaption = null;
if (aqString.Find(TargetObject.FullName, "d_browse", 0, false) > 0)
{
switch (TargetObject.ObjectType)
{
case "Edit":
case "Client":
// insert caption finder here for browsers
break;
case "Button":
FindObjectCaption = TargetObject.Caption
break;
}
}
else
{
switch (TargetObject.ObjectType)
{
case "Edit":
case "Client":
if (aqString.SubString(TargetObject.Caption, aqString.GetLength(TargetObject.Caption) - 2, 2) == "_t")
{
FindObjectCaption = TargetObject.Child(0).Caption + " Label";
}
else
{
var PropArray = Array ("Caption");
var ValArray = Array (TargetObject.Caption + "_t");
var LabelChildren = TargetObject.Parent.FindAllChildren(PropArray, ValArray, 1);
LabelChildren = (new VBArray(LabelChildren)).toArray();
if (LabelChildren.length > 0)
{
FindObjectCaption = LabelChildren[0].Caption;
}
}
break;
case "Button":
FindObjectCaption = TargetObject.Caption
break;
}
}
}