Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) change color link and property (Read 12393 times)
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
change color link and property
Oct 15th, 2018 at 11:36am
Print Post  
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 | 222 Downloads )
Sans_titre3.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: change color link and property
Reply #1 - Oct 15th, 2018 at 4:22pm
Print Post  
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
  
Back to top
 
IP Logged
 
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
Re: change color link and property
Reply #2 - Nov 6th, 2018 at 9:42pm
Print Post  
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
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: change color link and property
Reply #3 - Nov 7th, 2018 at 12:09pm
Print Post  
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
  
Back to top
 
IP Logged
 
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
Re: change color link and property
Reply #4 - Nov 9th, 2018 at 4:12pm
Print Post  

thank you for your help. Smiley
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.
Undecided

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 | 232 Downloads )
pTwolabel.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: change color link and property
Reply #5 - Nov 12th, 2018 at 7:38am
Print Post  
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
  
Back to top
 
IP Logged
 
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
Re: change color link and property
Reply #6 - Nov 13th, 2018 at 10:58am
Print Post  
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 | 243 Downloads )
aftersave.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: change color link and property
Reply #7 - Nov 13th, 2018 at 1:24pm
Print Post  
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
  
Back to top
 
IP Logged
 
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
Re: change color link and property
Reply #8 - Nov 13th, 2018 at 3:56pm
Print Post  
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);
}
}
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: change color link and property
Reply #9 - Nov 13th, 2018 at 4:55pm
Print Post  
Could you attach XML file for the above example?
  
Back to top
 
IP Logged
 
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
Re: change color link and property
Reply #10 - Nov 14th, 2018 at 7:23am
Print Post  
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
  

testXml.rar ( 3 KB | 232 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: change color link and property
Reply #11 - Nov 14th, 2018 at 12:21pm
Print Post  
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
  
Back to top
 
IP Logged
 
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
Re: change color link and property
Reply #12 - Nov 14th, 2018 at 4:30pm
Print Post  
Thank you for your quick reply. Cheesy
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.
  

2018-11-14_17-23-29.rar ( 189 KB | 209 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: change color link and property
Reply #13 - Nov 14th, 2018 at 7:18pm
Print Post  
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
Select All
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
  
Back to top
 
IP Logged
 
08804139
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 22
Joined: Oct 15th, 2018
Re: change color link and property
Reply #14 - Dec 21st, 2018 at 10:11pm
Print Post  
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 | 227 Downloads )
test_002.png
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint