I am trying to write a MapBasic function to check whether or not an object can be used with the Overlap/AreaOverlap functions – I need to tell whether it's a closed shape or a line/arc/point/text object.
I have two questions.
-
Is there an existing function that will do this?
-
Why doesn't this work?
Function IsObjectRegion(ObjAlias As Alias) As Logical Dim ObjectType As SmallInt Note OBJ_TYPE_POINT ' This popup is displayed correctly Note "Crash Now." ' This doesn't display. ' Instead you get an error that says "could not convert data". ObjectType = ObjectInfo(ObjAlias, OBJ_INFO_TYPE) Do Case ObjectType Case OBJ_TYPE_REGION IsObjectRegion = True print "Object WAS a region" Case OBJ_TYPE_RECT IsObjectRegion = True print "Object WAS a region" Case OBJ_TYPE_ROUNDRECT IsObjectRegion = True print "Object WAS a region" Case OBJ_TYPE_ELLIPSE IsObjectRegion = True print "Object WAS a region" Case Else IsObjectRegion = False print "Object was NOT a region" End Case End Function
Best Answer
I think you need to be passing an object variable into the function, not an alias which is just a column reference.
If you wanted to test this out with the currently selected object, you could call the function like this:
This should return True/False.
James