Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Inherit MainForm (Read 3350 times)
kpdamico@aol.com
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: May 9th, 2008
Inherit MainForm
Jun 2nd, 2008 at 3:01pm
Print Post  
I am using the latest version of Flowchart.Net and am attempting to inherit the main form onto a form I call decomp.  It is working okay when dropping nodes and links on it.  However, when I attempt to access a node or link to change text it won't update the display. 

After inheriting the Flowcharter MainForm do I have to add anything to the inherited form declaration section?

Thanks
Ken Roll Eyes
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inherit MainForm
Reply #1 - Jun 2nd, 2008 at 5:46pm
Print Post  
Hi Ken,

I've added Form1 inherited from MainForm, and changed the Main method implementation from

Application.Run(new MainForm());

to

Application.Run(new Form1());

Now after dropping item on the form, I can set its text from the property grid and it repaints ok. Does that work in your project?

Stoyan
  
Back to top
 
IP Logged
 
kpdamico@aol.com
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: May 9th, 2008
Re: Inherit MainForm
Reply #2 - Jun 2nd, 2008 at 7:38pm
Print Post  
Stoyan,

I can update the text on the inherited form from the property box, but I cannot access the node programmatically.  I even tried using Form_decomposition._doc.Items - a partial snippet appears below:

For Each item As DiagramItem In Form_decomposition._doc.Items
         

           If TypeOf item Is ShapeNode Then
               Dim shape As ShapeNode = item
               Debug.Print("found shape " & (shape.Shape.Id))

               'if task or And Gate or Or Gate or Xor Gate then
               If ((shape.Shape.Id = "Task") Or (shape.Shape.Id = "Delay") Or (shape.Shape.Id = "Or2") Or (shape.Shape.Id = "Xor")) Then
                   If (shape.ZIndex = Isel) Then
                       Debug.Print("found task node that was double clicked")

This code never finds the task node.

It's funny because I can add nodes, links, single click and double click (and everything seems to work just like the main form but I can't access the nodes or links)    PLEASE HELP
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inherit MainForm
Reply #3 - Jun 3rd, 2008 at 8:04am
Print Post  
Are you sure Form_decomposition refers to the form instance visible on the screen? What code are you using to open the inherited form?
  
Back to top
 
IP Logged
 
kpdamico@aol.com
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: May 9th, 2008
Re: Inherit MainForm
Reply #4 - Jun 3rd, 2008 at 1:42pm
Print Post  
The following snippet from my program launches the decomp window

'launch new window
          Dim formT As New Form_decomposition

                       formT.Visible = True
                       formT.SetDesktopLocation(200, 50)
                       formT.BringToFront()
                       formT.Activate()

This code works fine.  It launches the inherited form and allows me to add nodes and links and move them around, and update text thru the property window.  I just can't see them via the program.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inherit MainForm
Reply #5 - Jun 3rd, 2008 at 1:47pm
Print Post  
Is there a new node shown if you call formT._doc.Factory.CreateShapeNode(10, 10, 100, 100) after formT.Activate() ?
  
Back to top
 
IP Logged
 
kpdamico@aol.com
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: May 9th, 2008
Re: Inherit MainForm
Reply #6 - Jun 3rd, 2008 at 2:31pm
Print Post  
Stoyo,

That worked - displayed a big node.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inherit MainForm
Reply #7 - Jun 3rd, 2008 at 2:43pm
Print Post  
So if you now assign formT._doc.Nodes[0] to a ShapeNode variable and set its Text, isn't it displayed correctly?
  
Back to top
 
IP Logged
 
kpdamico@aol.com
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: May 9th, 2008
Re: Inherit MainForm
Reply #8 - Jun 3rd, 2008 at 6:23pm
Print Post  
Stoyo,

Could you please provide a little VB snippet for that?

Thanks
Ken Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inherit MainForm
Reply #9 - Jun 3rd, 2008 at 6:37pm
Print Post  
formT._doc.Factory.CreateShapeNode(10, 10, 100, 100)
dim node as ShapeNode = formT._doc.Nodes(0)
node.Text = "Start"

Does that display some text? If it works, perhaps Form_decomposition does not refer to the same form as formT. I remember something about VB creating a default form instance named as the class, so perhaps the default instance is hidden, and its Diagram member _doc stays empty all the time. While formT refers to the visible instance of the form class and its _doc lets you access the items shown on the screen?

Stoyan
  
Back to top
 
IP Logged
 
kpdamico@aol.com
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: May 9th, 2008
Re: Inherit MainForm
Reply #10 - Jun 5th, 2008 at 4:33pm
Print Post  
Stoyo,

I think your right.  I just looked at the number of items in Form_decomposition._doc.Items and they are zeroe.  All of the nodes are within the MainForms set MainForm._doc.Items.  The major problem for me is I was hoping to use z index to uniquely identify nodes.  I can't do that now as I have 2 nodes with the same z index.  Is there another way of uniquely addressing these nodes?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inherit MainForm
Reply #11 - Jun 6th, 2008 at 7:15am
Print Post  
Hi Ken,

You might assign some identifier to the node's Tag. It could be the result of Guid.NewGuid(), or the name of the form + node.ZIdex.ToString(). Later you can call Diagram.FindNode() to find a node by its tag.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
kpdamico@aol.com
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: May 9th, 2008
Re: Inherit MainForm
Reply #12 - Jun 6th, 2008 at 12:22pm
Print Post  
Stoyan,

I was wondering about the Tag.  I think I will give your idea a spin.  Thanks for the help.

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