Class Diagram

Hi
We have recently downloaded GoWin
4.1.0.4 for .NET 4.0 Windows Forms and
started a test project for creating class diagram. We browsed your
samples and NodeLinkDemo.CollapsingRecordNode( vb.net) was interesting.
We have some questions in this regard:

1.How can we add a method to this class to return currently selected CollapsingRecordNodeItem/s? 2.When mouse goes over CollapsingRecordNodeItem its port handles should be visible. 3.How can we find out that a link has been created between two NodeItems and identify From/To Nodes? 4.How can we find out currently selected CollapsibleRecordNode/s in GoView? 5.How can we add a CheckBox to each CollapsingRecordNodeItem?

Regards
Brad Oseiki

1.How can we add a method to this class to return currently selected CollapsingRecordNodeItem/s?



Selection is tracked by the GoView.Selection class. You can find the CollapsingRecordNodeItem in the Selection collection. From the item, you can use



public static CollapsingRecordNode FindCollapsingRecordNode



to get the node with a selected item.



2.When mouse goes over CollapsingRecordNodeItem its port handles should be visible.



You can set LeftPort.Style and RightPort.Style to make them visible. (FlowCharter.GraphNode does this in OnMouseOver… use that as a reference.)



3.How can we find out that a link has been created between two NodeItems and identify From/To Nodes?



See Walter’s first reply here.



4.How can we find out currently selected CollapsibleRecordNode/s in GoView?



see 1.



5.How can we add a CheckBox to each CollapsingRecordNodeItem?



Just duplicate what CollapsingRecordNodeItem does to add the icon. In fact, you probably want to just add another icon (one checked, one unchecked) and handle the clicks to change state. You don’t want to really use a CheckBox Control.

Hi

  1. I’ve tried to copy& paste GoImage image.but it can’t show GoView’s Image.How I can specify an image for GoImage?
    2.we implemented OnMouseOver, is there any OnMouseOut event or something similar?

Regards

  1. Sorry… I don’t understand what you’re asking. All the code is there for one image, just duplicate that and change “Image” or “Icon” to “checkbox” as appropriate. The Image is loaded in “Init”. You probably don’t need to be able to specify the image names for the checkbox externally, but you do need to be able to set/get the “checked” state, which chooses the appropriate image.



    2. Flowcharter does this in GoView.OnBackgroundHover.

Hi
1.How I can add another goImage to the right side of CollapsingRecordNodeItem .I tried :

                _theGoImage2 = New GoImage()
_theGoImage2.Selectable = False
_theGoImage2.AutoResizes = False
_theGoImage2.AutoRescales = False
_theGoImage2.Name = strImageName
_theGoImage2.Image=my.Resources.PrimeryKey
_theGoImage2.Size = New SizeF(16, 16)
Add(_theGoImage2)

But it showes just this icon.I want to show two icons in the right and two in the left(eg: show primery key, not null,…)

2.How I can let end user to reorder CollapsingRecordNodeItem ? for example move one to first position in the list.can I let end user do it with
drag & drop?

Regards
Brad

to answer 2:



Look in the code. under CollapsingRecordNodeItemList is



//??? comment out the following three assignments, and change Insertable to true,

// if you want to be able to drag around itemlists within a CollapsingRecordNode

this.Copyable = false;

this.Deletable = false;

this.DragsNode = true;

// this.Insertable = true;



and under CollapsingRecordNodeItem is



//??? comment out the following three assignments if you want to be able to

// drag around individual items within a CollapsingRecordNode



this.Copyable = false;

this.Deletable = false;

this.DragsNode = true;





to just drag items, but not whole lists, comment out the 3 under CollapsingRecordNodeItem and enable Insertable under CollapsingRecordNodeItemList.

To answer 1 above:



It’s a little more involved than I led you to believe earlier.



CollapsingRecordNodeItem is coded assuming there is only the 1 collapsing handle and/or 1 image in the Item. So… adding images would really mean generalizing the image handle code there to handle more than one.



The Image property, is just the first GoImage typed object in the GoTextNode (CollapsingRecordNodeItem is derived from GoTextNode).



So… you’d have to change



1. Init to allow passing in more than 1 imgname

2. Change CalcIconSpace to return the width of the images to the left of the label (this sets the TopLeftMargin.Width of the label so there is room for the images)

3. Change LayoutChildren to position each of the images, relative to the Label.



Now… if you can do this without adding references like _theGoImage2, that simplifies other bits.



Do you always have 2 icons on the left and 2 on the right, or does it vary per Item?

Hi Jake
Thanks Jake! For the drag & drop it worked really great! Yes , It will always have two icons on the right and two on the left.To change the code seems to be error-prone because there is no graphical picture that shows what is space,margins,handle, … and what this methods do? Can you please provide a code snippet in this regard?

Regards
Brad