The MindFusion Forums
Flow Diagramming Components >> ASP.NET >> change color link and property
https://mindfusion.eu/Forum/YaBB.pl?num=1539603415

Message started by 08804139 on Oct 15th, 2018 at 11:36am

Title: change color link and property
Post by 08804139 on Oct 15th, 2018 at 11:36am
hello,
I'm using ASP webforms and mindfusion.
how can I write two text in the same link ?
how can I change the link color using a color palette?
how can I remove link arrows and use a single line?
as present in the attachment
thanks
Sans_titre3.png ( 3 KB | 229 Downloads )

Title: Re: change color link and property
Post by Slavcho on Oct 15th, 2018 at 4:22pm
Hi,


Quote:
how can I write two text in the same link ?


Call the link's AddLabel method (or addLabel in JS code).


Quote:
how can I change the link color using a color palette?


Set link's Pen property (setPen / setStroke in JS).


Quote:
how can I remove link arrows and use a single line?


Set link's HeadShape property to Arrowheads.None / null.

Regards,
Slavcho
Mindfusion

Title: Re: change color link and property
Post by 08804139 on Nov 6th, 2018 at 9:42pm
Hello,
I want when I click on the link in the top part a text box opens and even in the bottom part of the link
so two text box in the link.
Thanks

Title: Re: change color link and property
Post by Slavcho on Nov 7th, 2018 at 12:09pm
You could call link.addLabel from linkClicked handler and then LinkLabel.setLinkLengthPosition(...) to move the label towards the start or end of the link.

Regards,
Slavcho

Title: Re: change color link and property
Post by 08804139 on Nov 9th, 2018 at 4:12pm

thank you for your help. :)
but when I define two labels I initialize side javascript code and when I click to change. the original text remains below the new text.
so there is a problem of modification textarea zone size.
:-/

Code :
  function onLinkCreated(sender, args) {
        var link = args.getLink();
        link.setHeadShape("");
        link.setBaseShape("");
        link.addLabel("T1").setLinkLengthPosition(0.1);
        link.addLabel("T1").setLinkLengthPosition(0.9);

      
    }
pTwolabel.png ( 9 KB | 237 Downloads )

Title: Re: change color link and property
Post by Slavcho on Nov 12th, 2018 at 7:38am
Hi,

Maybe there's duplicated T1 label overlapping the edited one? How many elements can you see in link.labels array, e.g. from a breakpoint in linkClicked handler?

Regards,
Slavcho

Title: Re: change color link and property
Post by 08804139 on Nov 13th, 2018 at 10:58am
Hello   
*the same problem at the label editing level the text box is very small, also if I delete the label it becomes inaccessible.
*the link changes behavior after save
how do I keep their behavior even after saving
attached pice present

1 before saving
2 after saved
I want always presented as 1
I use mindfusion ASP webforms
Thanks for your help
aftersave.png ( 13 KB | 250 Downloads )

Title: Re: change color link and property
Post by Slavcho on Nov 13th, 2018 at 1:24pm
Hi,

1. Handle the enterInplaceEditMode event to get a reference to the area element used as editor (args.control) and apply some minimum width / height to it.

2. What methods are you using to save and load?

Regards,
Slavcho

Title: Re: change color link and property
Post by 08804139 on Nov 13th, 2018 at 3:56pm
thank you for your reply.
I used the following two methods:

protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(tbFileName.Text))
        {
            string localDir = MapPath(@"Files\");
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            canvasView.SaveToXml((localDir + tbFileName.Text);
        }
    }

protected void btnLoad_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(listFileNames.SelectedValue))
        {
            string localDir = MapPath(@"Files\");
            canvasView.Diagram.LoadFromXml(localDir + listFileNames.SelectedValue,true);
        }
    }

Title: Re: change color link and property
Post by Slavcho on Nov 13th, 2018 at 4:55pm
Could you attach XML file for the above example?

Title: Re: change color link and property
Post by 08804139 on Nov 14th, 2018 at 7:23am
Hi,
When I click on the button save the diagram gets refreshed and becomes like the picture 2 presented above.
Method Save :
protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(tbFileName.Text))
        {
            string localDir = MapPath(@"Files\");      
            canvasView.SaveToXml(localDir + tbFileName.Text);
        }
    }
Method Load:
protected void btnLoad_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(listFileNames.SelectedValue))
        {
            string localDir = MapPath(@"Files\");
            canvasView.Diagram.LoadFromXml(localDir + listFileNames.SelectedValue,true);
        }
    }

attached XML file

https://mindfusion.eu/Forum/YaBB.pl?action=downloadfile;file=testXml.rar ( 3 KB | 237 Downloads )

Title: Re: change color link and property
Post by Slavcho on Nov 14th, 2018 at 12:21pm
Hi,

It loaded as a straight line in my test. Check if you aren't calling link.route() or diagram.routeAllLinks() methods in some event handlers?

Regards,
Slavcho

Title: Re: change color link and property
Post by 08804139 on Nov 14th, 2018 at 4:30pm
Thank you for your quick reply. :D
now the save and loading is working properly.
so I changed the style of the text box
Just the problem of editing the label link.
if I delete the label I can not insert it anymore and change position.
I presented my problem in the video.

https://mindfusion.eu/Forum/YaBB.pl?action=downloadfile;file=2018-11-14_17-23-29.rar ( 189 KB | 214 Downloads )

Title: Re: change color link and property
Post by Slavcho on Nov 14th, 2018 at 7:18pm
Right, the label isn't actually deleted but becomes hard to hit when its text is empty, and then the diagram starts editing the link.text property instead of a LinkLabel. You could extend the hit-testing method along these lines to always return one of the labels depending on distance from end points -


Code (]
DiagramLink.prototype.getObjectToEdit = function (point, element)
{
     if (element && (mflayer.isInstanceOfType(mdiag.LinkLabel, element)))
           return element;

     var label = this.labelFromPoint(point);
     if (label != null)
           return label;

     // above is the standard hit-testing code;
     // revise this depending on number of labels:
     if (point.distance(this.getStartPoint()) < 20)
           return this.labels[0):

;
     if (point.distance(this.getEndPoint()) < 20)
           return this.labels[2];

     return this.labels[1];

     //return this;
};


Regards,
Slavcho

Title: Re: change color link and property
Post by 08804139 on Dec 21st, 2018 at 10:11pm
Hello
can you give me more idea and clarify the previous point.
and how I can direct the text of the link on the left as indicated by the attachment.
thank you.

test_002.png ( 13 KB | 236 Downloads )

Title: Re: change color link and property
Post by Slavcho on Dec 24th, 2018 at 7:06am
The control invokes the method from previous point to decide what object to edit, and you can override it as shown to return whatever label is close to the double-click point when one is not directly under mouse pointer. If you are asking how to actually override the method, e.g. set AppletStartedScript to name of a function that should run when DiagramView has fully loaded on client side, and then call above code from that function.

Try setting labels' AutoArrange property to make them avoid the link sements.

Regards,
Slavcho

Title: Re: change color link and property
Post by 08804139 on Jul 24th, 2019 at 12:52pm
Hello
I want to open or export an image for example (.svg) from an .xml file.
thanks

Title: Re: change color link and property
Post by Slavcho on Jul 24th, 2019 at 12:59pm
Hi,

Try the Diagram.CreateImage method to export bitmaps, or the SvgExporter class for SVG drawings.

Regards,
Slavcho

Title: Re: change color link and property
Post by wincomhaj on Jul 26th, 2019 at 6:58am
I want the generation of the image to be from a sourcer .xml file and not from a diagram

Title: Re: change color link and property
Post by Slavcho on Jul 26th, 2019 at 8:58am
Our API is for creating diagrams and any PDF / SVG / bitmap export has to go through a Diagram object. You can find some examples on generating diagrams from XML here -

https://www.mindfusion.eu/onlinehelp/flowchartnet/index.htm?CC_Miscellaneous_1.htm

Regards,
Slavcho
Mindfusion

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.