Q: FlowChartX drag and drop method passes an object of type FLOWCHARTLibCtl.IdataObject, which I assume is just a typelib for the standard COM IDataObject. The problem is that I'm trying to access the data in the dataObj, but I'm getting "Automation type not supported in Visual Basic" runtime error. Do you have a workaround for this? Is there a better way to implement OLE drag and drop with your control in VB?

A: There's a new drag-and-drop mode called drProgrControlVB, which has the same functionality as drProgrControl. The difference is that the events, which are fired when the property is set to VB mode take as parameter IVBDataObject interface which is automation compatible. The FlowChartX VB events have the same names as those, which are fired in drProgrControl mode just the 'VB' suffix is added to them.

Q: I get an Application Fault if I try to access the DestinationBox property of the arrow passed into the RequestCreateArrow event!

A: When RequestCreateArrow is fired the arrow's DestinationBox object is still not set. We have added a new arrow property, called ExpectedDestination, that is valid only in RequestCreateArrow event handlers. It refers to the box or table that will be the arrow's destination object if the arrow creation is validated.

Q: I can not access the Font property of the box object, it throws an error each time.

A: By default the fonts of all objects (tables, boxes, arrows) have their fonts set to null/nothing . When a diagram object's font is null, the font of the flowchart is used to render the objects' text. The idea is to cut down memory usage by not allocating fonts for every diagram element. When the font of an object is null it uses the flowchart Font to render its text. So if you need different fonts for different objects you should first set them to some value, using the VB SET statement and after that you'll be able to access the Font property without errors.

Q: I want to be able to delete a table together with its related children. I don't see a method to be able to do that unless maybe If I create a group and use the DestroyGroup method. Not sure about that...

A: You could use recursive algorithm to make cascading deletes of tables, something like this:

sub CascadingDelete(tbl as Table)
  dim i as integer

 `this will delete all child tables
  For i = 1 To tbl.GetRelatedTables(1, 
   		 rlManyToOne).Count
     CascadingDelete tbl.GetRelatedTables(1,
	   rlManyToOne).Item(0)
  Next i

  `the current table has no more children
  `so we can delete it
  fc.DeleteItem tbl
end sub

sub someSub
  if fc.ActiveItem = itTable then
    CascadingDelete ActiveTable
  end if
end sub

Q: My system allows users to construct a flowchart, but I want to check for cycles before allowing an arrow to be placed. I have been using the RequestCreateArrow to validate the arrow based on the preceding and following objects, but I can't use the FindCycle function until the arrow has finally been placed. Do you know any work around for this problem?

A: You can use the FindShortestPath method to check if there will be a cycle with the arrow that's being created. For example, if the arrow is being created between boxes b1 -> b2, then if FindShortestPath(b2, b1) finds a path, means that adding the arrow to this path will result in a cycle (the arrow connects the both ends of the found path).

Another solution: if the arrow is being created from b2 to b1, then if FindShortestPath(b1, b2) returns a path, that means again that adding the arrow will result in a cycle.

So, in your RequestCreateArrow event handler you could use such code:

if FindShortestPath(arrow.SourceBox,
   ExpectedDestination) = Nothing then
 create = true
else
  	create = false
end if

Q: I would like to change an object's position (for example move a Box) programmatically. How can I do this with VB6?

A: Boxes and tables' positions can be changed with the SetRect method.