Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Create a Group (Read 5392 times)
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Create a Group
Sep 6th, 2010 at 1:20pm
Print Post  
Hi Stoyo,

1- I created a process flow in a FCX document then i want to take this process flow as a whole and insert it in a new FCX document as a single group, so how can this be done?

2- If i want to move this process flow within the same document as one unit, for example moving it to the center of a page or to its left edge, is there any way to do this programatically? i tried to use SetRect or MoveTo for each box, but the process flow is then ruined as the perpendicular arrows are elongated and have new points above the process flow.

Thanks in Advance
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Create a Group
Reply #1 - Sep 6th, 2010 at 3:49pm
Print Post  
Hi Andrew,

1. You could use a bsContainer box or a bsAxControl box hosting a Flowchart instance to contain the process flow. If using a hosted flowchart, you can load the flow document simply by calling LoadFromString or LoadFromFile. If using containers, call fc1.SaveToStream() and fc2.LoadFromStream() to transfer the items to the second flowchart without clearing its existing elements. After LoadFromStream, you can loop over SelectedBoxes and call their PutInContainer  method. You should also set the container's LayoutStyle to lsCustom to preserve the box positions.

2. If you use any of the above methods, you can set only the container's position and the children will move too. Otherwise you will have to loop over the arrow points and offset them via the CtrlPtX/Y properties.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: Create a Group
Reply #2 - Sep 7th, 2010 at 8:08am
Print Post  
Thank you so much,

That is really perfect
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: Create a Group
Reply #3 - Sep 28th, 2010 at 10:10am
Print Post  
1) Can you give me an example for using the SaveToStream and  LoadFromStream methods as i usually receive an error.

2) How can i decide the coordinates of the loaded boxes (LoadFromStream) or the Pasted ones (PasteFromClipboard).

Thanks in advance
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Create a Group
Reply #4 - Sep 29th, 2010 at 9:29am
Print Post  
1. You can create a memory stream via the CreateStreamOnHGlobal API function, e.g. in VB6:

Code
Select All
Private Declare Function CreateStreamOnHGlobal Lib "ole32" (ByVal hGlobal As Long, ByVal fDeleteOnRelease As Long, ppstm As Any) As Long

Dim memStreamDisp As Object
CreateStreamOnHGlobal 0, 1, memStreamDisp

Dim memStream As olelib.IStream
fcx.SaveToStream memStreamDisp
Set memStream = memStreamDisp
memStream.Seek 0, 0
fcx.LoadFromStream memStreamDisp 



olelib.IStream is from the first type-library by Eduardo Morcillo on this page:
http://www.mvps.org/emorcillo/en/code/vb6/index.shtml

2. If you need to offset the items after pasting them, you can do that by iterating the selection lists and call MoveTo for boxes and set CtrlPtX/Y for arrows. The following seems to work, but I haven't tried it for all types of arrow property combinations:

Code
Select All
Sub MoveAllSelected(dx As Integer, dy As Integer)
	Dim b As box
	Dim t As table
	Dim a As arrow

	For Each a In fcx.SelectedArrows
		For i = 1 To a.CtrlPtCount - 2
			a.CtrlPtX(i) = a.CtrlPtX(i) + dx
			a.CtrlPtY(i) = a.CtrlPtY(i) + dy
			a.Update
		Next i
	Next a

	For Each b In fcx.SelectedBoxes
		b.MoveTo b.left + dx, b.top + dy
	Next b

	For Each t In fcx.SelectedTables
		t.MoveTo t.left + dx, t.top + dy
	Next t

End Sub 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: Create a Group
Reply #5 - Sep 29th, 2010 at 10:51am
Print Post  
Thanks a lot, i will try the code now.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint