HtmlEditor :  Phorum 5 The fastest message board... ever.

This is the discussion forum for the HtmlEditor. See also the HtmlEditor home page, where you can download the control, and the Documentation Wiki, a collaborative project for documenting the control.

Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
Navigating links while in design mode?
Posted by: JRM (---.dyn.optonline.net)
Date: Friday, 02-Jun-2006, 04:34:51

Is there a way that one can make it so that the behavior of a link in design/edit mode is the same as browsing mode?

I realize that's kind of weird, because clicking on a link in design mode should just move the cursor there, but in my application links are non-editable (they have the ATOMICSELECTION attribute set).

Re: Navigating links while in design mode?
Posted by: JRM (---.dyn.optonline.net)
Date: Friday, 02-Jun-2006, 06:13:03

Turns out there's at least one way to do it. In your <A> tag, set both of these attributes:

contentEditable=false
unselectable=on

(and do not set ATOMICSELECTION as I mentioned in my original post)

I got lucky stumbling on that combination. For a complete list of mostly non-standard element properties, check out:

[msdn.microsoft.com]

Re: Navigating links while in design mode?
Posted by: Tim (---.gotadsl.co.uk)
Date: Friday, 02-Jun-2006, 07:54:26

Interesting, thanks.

Tim

Re: Navigating links while in design mode?
Posted by: James Hancock (---.amtelecom.net)
Date: Saturday, 03-Jun-2006, 20:00:08

Anyone figured out how to do this when the link is editable? I want people to be able to hold down the CTRL key and click on them...

Re: Navigating links while in design mode?
Posted by: Bhushan Bhure (---.static.exatt.net)
Date: Monday, 05-Jun-2006, 06:11:51

Write your code on onmousemove event
htmlDocumentEvents_Event_onmousemove

// htmlEditorQuickInfo is html control

// Do action if element is href
if ((pEvtObj.ctrlKey) && (null != pEvtObj.srcElement) && ( TAG_ACHOR == pEvtObj.srcElement.tagName))
{
this.htmlEditorQuickInfo.Cursor = Cursors.Hand;
setAchorTagValue(pEvtObj);
}


private void setAchorTagValue(IHTMLEventObj pEvtObj)
{
string url = pEvtObj.srcElement.getAttribute(ATTRIBUTE_HREF,1).ToString();
pEvtObj.srcElement.title = url + @"\r\n CTRL + click to follow link"
}


Write your code on onmouseup event
htmlDocumentEvents_Event_onmouseup
if ((null != pEvtObj.srcElement) && (TAG_ACHOR == pEvtObj.srcElement.tagName))
{
if ((pEvtObj.ctrlKey))
{
NavigateLink((HTMLAnchorElement) pEvtObj.srcElement);
}
}


private bool NavigateLink(HTMLAnchorElement anchorElement)
{
Process.Start(anchorElement.getAttribute("href",1).ToString());
}


Hope this will help you.

I am using Carl Nolan Application.

Bhushan,

Re: Navigating links while in design mode?
Posted by: James Hancock (---.amtelecom.net)
Date: Wednesday, 07-Jun-2006, 05:11:30

Fantastic! Works like a charm smiling smiley
Thanks!

Re: Navigating links while in design mode?
Posted by: Jon (---.halliburton.com)
Date: Thursday, 15-Jun-2006, 20:22:20

In Bhushan Bhure's post, what is pEvtObj, and is this code C++?

Thanks,

Jon

Re: Navigating links while in design mode?
Posted by: Jon (---.houston.res.rr.com)
Date: Friday, 16-Jun-2006, 00:43:05

Ok, I figured out the code, but I do not have a html mouse move event for my html editor. The regular mouse move event handler is there, but I cannot use the HtmlEventHandler/HtmlEventArgs for the new method. Any Ideas?

This is what I have(which does not work):

this.htmlMain.MouseMove /*.HtmlEvent */+= new onlyconnect.HtmlEventHandler(this.htmlMain_MouseMove);

private void htmlMain_MouseMove(object sender, onlyconnect.HtmlEventArgs e)
{
if(e.Event.srcElement != null && e.Event.srcElement.tagName == "A")
{
string[] url = e.Event.srcElement.innerText.Split(' ');
string[] Chapter = url[1].Split(':');
ttMain.SetToolTip(htmlMain,url[0]);
}
}

Thanks,

Jon

Re: Navigating links while in design mode?
Posted by: Tim (---.gotadsl.co.uk)
Date: Friday, 16-Jun-2006, 07:20:40

Are you using the HtmlEditor from this site? If so, you can get this event by modifying:

public void onmousemove(IHTMLEventObj o)

which is in HtmlSite.cs.

Tim

Re: Navigating links while in design mode?
Posted by: Jon (---.halliburton.com)
Date: Friday, 16-Jun-2006, 15:03:51

I am using the htmleditor from this site, but I do not quite understand what you mean by modifying the code above. That line of code is not in my HtmlSite.cs. Could I have an old version (I downloaded it three day ago from the main site)?

Sorry for the inconvience.

Thanks again,

Jon

Re: Navigating links while in design mode?
Posted by: Jon (---.halliburton.com)
Date: Friday, 16-Jun-2006, 16:22:57

Ok, I guess I should stop posting questions, because I solved my problem again. Sorry. I also should have looked at the title of this topic, because I wanted this in regular mode, not design.

Thanks again,

Jon



Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
6tpGF
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.