Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic findGroup (Read 3253 times)
T.Pascal
Guest


findGroup
Mar 16th, 2006 at 6:13am
Print Post  
hi , i've tryied to use the findGroup methode,
as it said , i've tagged the group.
Code
Select All
 <Serializable()> Friend Class GroupProps
	  Public groupId As Integer = 0
    End Class 


and every times a group is created , i set groupProps.groupId = boxProps.boxId

the only problem i have is to know how to use findGroup methode to find back a group with a specified Id
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: findGroup
Reply #1 - Mar 16th, 2006 at 7:05am
Print Post  
Hi,

You can override the Equals method in the GroupProps  class and return true if the IDs are equal. Then when looking for a group, create a new GroupProps instance, set its ID and call FindGroup passing the properties object as argument.

Stoyan
  
Back to top
 
IP Logged
 
t.Pascal
Guest


Re: findGroup
Reply #2 - Mar 16th, 2006 at 8:19am
Print Post  
hi ,
I've tryed this:

Code
Select All
Private Sub fc_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles fc.MouseMove
	  If e.Button = MouseButtons.None Then
		Dim point As New Point(e.X, e.Y)
		Dim mousePos As New PointF
		tboxcreating = False
		mousePos = fc.ClientToDoc(point)
		currentBox = fc.GetNodeAt(mousePos, True, True)
		If Not currentBox Is Nothing Then
		    If currentBox.Shape.Id = "Rectangle" Then
			  fc.Behavior = BehaviorType.CreateBox
			  tboxcreating = True
			  '
			  Dim boxprop As boxProps = currentBox.Tag
			  Dim FGroup As New groupProps
			  FGroup.groupId = boxprop.boxId
			  currentGroup = fc.FindGroup(FGroup)
			  '
		    Else : fc.Behavior = BehaviorType.FlowChart
		    End If
		End If
	  End If
    End Sub


 Private Sub fc_BoxCreated(ByVal sender As Object, ByVal e As MindFusion.FlowChartX.BoxConfirmArgs) Handles fc.BoxCreating

	  onBoxCreated(e.Box)
	  If e.Box.Shape.Id = "Rectangle" Then
		Dim boxprop As boxProps = e.Box.Tag
		Dim groupProps = New groupProps
		newgroup = fc.CreateGroup(e.Box)
		newgroup.Tag = groupProps
		Dim groupTag As groupProps = newgroup.Tag
		groupTag.groupId = boxprop.boxId
	  End If

	  If tboxcreating = True Then
		currentgroup.AttachToCorner(e.Box, 0)
	  End If
    End Sub


    Private Sub onBoxCreated(ByVal node As Box)
	  Dim props = New boxProps
	  count += 1
	  node.Tag = props
	  Dim boxTag As boxProps = node.Tag
	  boxTag.boxId = count
    End Sub 



but it says the currentGroup is null  , so every time i create a box in another one , it return a 'System.NullReferenceException' error.

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: findGroup
Reply #3 - Mar 16th, 2006 at 9:11am
Print Post  
Hi,

Have you implemented the Equals method for the properties class ? Anyway, can't you use the MasterGroup or SubordinateGroup properties of the Box to find the related group ?

Stoyan
  
Back to top
 
IP Logged
 
T.Pascal
Guest


Re: findGroup
Reply #4 - Mar 16th, 2006 at 9:27am
Print Post  
hi ,
you right , i've try
Code
Select All
currentGroup = currentBox.SubordinateGroup 


and it works perfectly

thanx alot Stoyan
  
Back to top
 
IP Logged
 
T.Pascal
Guest


Re: findGroup
Reply #5 - Mar 30th, 2006 at 5:41am
Print Post  
hi ,

like findGroup , i don't know how to use findBox.
the tag is composed by several item, and one of them is unique for each box (boxId as integer) how could i find a box wich i only know the boxId and nothing else ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: findGroup
Reply #6 - Mar 30th, 2006 at 9:01am
Print Post  
Hi,

You can implement an Equals method in the box tag class, so it returns true if two tag objects contain the same unique id. Then pass to the FindBox method a tag instance whose id is set, and you will get the box whose tag contains the same id.

Or otherwise just do a foreach loop and compare the box.Tag.Id with the one you are looking for, that won't be slower than FindBox.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint