 |
|
 |
I've got .exe.manifest in with the same folder as the exe app, but the hyperlinks' position moved(not what i want).but when i delete the manifest file,then it's ok!
why is that ?
thank you!
|
|
|
|
 |
|
 |
Excellent work, thank you!
I tested it under Vista and found that the links looked somehow bold faced.
The reason is IMO that the link characters are painted with a transparent
background, and the original characters "shine through" (on XP, they are
covered completely).
However, I worked around it by filling the space with the background color first.
I replaced
pDC->TextOut(pt.x, pt.y, chToken);
with
CSize sz = pDC->GetTextExtent(chToken);
pDC->FillSolidRect(pt.x, pt.y, sz.cx, sz.cy, GetStyle()&ES_READONLY?GetSysColor(COLOR_BTNFACE):pDC->GetBkColor());
pDC->TextOut(pt.x, pt.y, chToken);
Regards
Guido
|
|
|
|
 |
|
 |
Hi,
I've encountered a problem with chinese using this control
The position of the blue hyper link text shifted from the black underlying text when the text contains Chinese characters, the amount of shift is determined by the count of Chinese charaters within the text.
I think this problem is resulted by the encoding staff, can you fix it?
|
|
|
|
 |
|
 |
Hey javan, this problem is probably being caused by character encoding issues, no dought.
I had zero experience in working with Unicode at the time, although I am not sure if the default Windows TEXT control supports unicode, which if it does, it should work fine.
I have no way of testing or fixing the issue, because I do not have a chinese pinyin(correct?) -- I also lack the time.
If you happen to fix it, by all means send me the updates and I'll be sure to include them and give you proper attribution.
Cheers,
Alex
|
|
|
|
 |
|
 |
Just simply change the method DrawHyperlinks() like this:
...
for(int i=0; i<m_linkOffsets.size(); i++)
{
csTemp = IsHyperlink(pt_mouse);
if(csTemp.IsEmpty())
pDC->SetTextColor(m_clrNormal);
else
{
if(csTemp==csBuff.Mid(m_linkOffsets[i].iStart, m_linkOffsets[i].iLength))
{
CPoint pt_lastchar = SendMessage(MSG_GETPOSFROMCHAR,GetWindowTextLength()-1,0);
if(pt_mouse.y>(pt_lastchar.y+m_nLineHeight))
pDC->SetTextColor(m_clrNormal);
else
pDC->SetTextColor(m_clrHover);
}
else
pDC->SetTextColor(m_clrNormal);
}
int j = m_linkOffsets[i].iStart;
CString strText;
strText = csBuff.Mid(m_linkOffsets[i].iStart,m_linkOffsets[i].iLength);
pt = ::SendMessage(m_hWnd,MSG_GETPOSFROMCHAR,j, 0); pDC->TextOut(pt.x,pt.y,strText);
#if 0
for(int j=m_linkOffsets[i].iStart; j<(m_linkOffsets[i].iStart+m_linkOffsets[i].iLength); j++)
{
TCHAR chToken = csBuff.GetAt(j); pt = PosFromChar(j);
int iSelStart=0, iSelFinish=0;
GetSel(iSelStart, iSelFinish);
if(IsSelection(iSelStart, iSelFinish))
{
if(j>=iSelStart && j<iSelFinish)
continue; else
{
if ((unsigned char)chToken<0x80)
{
pDC->TextOut(pt.x, pt.y, chToken); }
else
{
TCHAR cText[3] = {0};
cText[0] = csBuff.GetAt(j);
cText[1] = csBuff.GetAt(j+1);
pDC->TextOut(pt.x,pt.y,cText);
j++;
}
}
}
else {
if ((unsigned char)chToken<0x80)
{
pDC->TextOut(pt.x, pt.y, chToken); }
else
{
TCHAR cText[3] = {0};
cText[0] = csBuff.GetAt(j);
cText[1] = csBuff.GetAt(j+1);
pDC->TextOut(pt.x,pt.y,cText);
j++;
}
}
}
#endif
|
|
|
|
 |
|
 |
I agree, this class is very nice. Thank you!
|
|
|
|
 |
|
 |
I would like to know if it OCX version exists because I work in VBA (MS Word 2003) and I would like to use this great control. Thanks
|
|
|
|
 |
|
 |
Hey Kamil,
Thanks for the kind words. Unfortunately, this control was developed in MFC and was intended to be used as such. I currently do not have the time to port it over to ATL for compilation into an OCX/ActiveX control.
It's been a while since I have done any serious development in MFC but I believe you can actually create OCX controls with MFC using one of the app wizards. It's possible you could cut and paste the code from my control into an MFC OCX and compile for ActiveX use.
I'm finding the only constant in software development is change it self.
|
|
|
|
 |
|
 |
how can i begin to write in a new line in edit box
|
|
|
|
 |
|
 |
Hey there.
It's been a while since I developed and released this code, but...
I believe hitting ENTER should cause a newline, no? Perhaps SHIFT+ENTER?
Make sure you have the style bit set so as to allow the EDIT control multiple lines
ES_MULTILINE is required.
Hope that helps
I'm finding the only constant in software development is change it self.
|
|
|
|
 |
|
 |
... and release the device contexts which you retrieved!
HyperEdit.cpp
void CHyperEdit::PreSubclassWindow()
{
...
CDC* pDC = GetDC();
ASSERT(pDC);
...
ReleaseDC(pDC); }
HyperEdit2.cpp
void CHyperEdit::DrawHyperlinks()
{
...
CDC* pDC = GetDC();
ASSERT(pDC);
...
pDC->SelectObject(pTemp); ReleaseDC(pDC); }
And don't forget the cursors, they also want to be free!
HyperEdit.cpp
CHyperEdit::~CHyperEdit()
{
if (m_oFont.m_hObject != NULL)
{
m_oFont.DeleteObject();
}
if (m_hHandCursor != NULL)
{
DestroyCursor(m_hHandCursor); }
}Note: This is necessary because the cursor was loaded from winhlp32.exe and the cursor handle was retrieved via CopyCursor()[^].
Apart from these glitches your control really rocks... thanks for sharing!
cheers,
mykel
OMM: "Let us be thankful we have commerce. Buy more. Buy more now. Buy. And be happy."
|
|
|
|
 |
|
 |
Thanks for this.
I'm using it in an over-indulgent About Dialog with lots of silly animated eye-candy.
I noticed CPU usage jumped from 30% to 90% when mousing over the HyperEdit control.
I was able to reduce this down to 40% by avoiding the call to DrawHyperlinks() in every single call to OnMouseMove. I added a boolean m_bHoveringHyperText to hold the state of the hyperlinks, and modified OnMouseMove to only re-draw when the state changes:
<code>
void CHyperEdit::OnMouseMove(UINT nFlags, CPoint point)
{
CEdit::OnMouseMove(nFlags, point);
CString csURL = IsHyperlink(point);
if(!csURL.IsEmpty()){
CPoint pt_lastchar = PosFromChar(GetWindowTextLength()-1);
if(point.y<=(pt_lastchar.y+m_nLineHeight))
::SetCursor(m_hHandCursor);
if (!m_bHoveringHyperText) { DrawHyperlinks();
m_bHoveringHyperText = true; }
} else { if (m_bHoveringHyperText) { DrawHyperlinks();
m_bHoveringHyperText = false; }
}
}
</code>
Cheers,
Robin.
|
|
|
|
 |
|
 |
Cool
I'll apply those changes as soon as I can find time to do so...
Much appreciated
Cheers
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
 |
|
 |
I got a option.
Just store the last hyperlink in a static CString Variable and compare it with the current hyperlink.
in case both are same just cahnge the MouseCursor else go ablout the usual work.
Using this i was able to get the cpu usage down to nothing. just normal no spikes even when you move the mouse in and out of the range for the Hyperlink or within the hyperlink itself.
The Debugger
|
|
|
|
 |
|
 |
can you please show examples of what you have described .
thanks
|
|
|
|
 |
|
 |
Did you try it on Japanese. It doesn't work when I type Japanese.
|
|
|
|
 |
|
 |
Sorry for the late delay, but I never received the email
To answer your question...nope I haven't tried it with Japanese.
Whats happening???
Have you tried it with any other languages???
How do I print my voice mail?
|
|
|
|
 |
|
 |
Thank you for your answer.
I use IME to type some Japanese in your control after that I typing some hyperlinks like "http://codeproject.com" with input method of IME is still Japanese, in this situation your control could not detect that it is hyperlink.
|
|
|
|
 |
|
 |
To be honest I have no idea...
One question...
When you type in Japanese do you type http:// or are the characters different???
The code looks specifically for http://
How do I print my voice mail?
|
|
|
|
 |
|
 |
Here is step by step to reproduce this error.
Step 1: Select your edit control.
Step 2: Change IME to Japanese
Step 3: Type string like this "これはマイクロソフトのホームページ http://www.microsoft.com"
After typing this string you can see that your control could not detect that "http://www.microsoft.com" is a hyperlink.
|
|
|
|
 |
|
 |
I found this page while looking for something else via Google, and decided, since I was working on a project using Unicode, I'd have a look at this one for a minute. It would seem the MS IME converts the space after the kana into code point U+3000 (IDEOGRAPHIC SPACE), not U+0020 (ASCII space). If I add U+3000 to the whitespace list in IsWhiteSpace, it works for me. Note that this is in Unicode mode (UNICODE set), since I'm running US English Windows here; the equivalent Shift_JIS code point is 0x8140.
|
|
|
|
 |
|
 |
Somebody retyped my article and made it look all pretty...
I appreciate it, thank you!!!
It's even got those little private and protected icon symbols beside the functions
How do I print my voice mail?
|
|
|
|
 |
|
 |
You might consider using ON_CONTROL_REFLECT_EX(EN_CHANGE, OnChange) and returning FALSE from OnChange to allow the parent dialog to still get the notification message.
Any tips on how this could be used in a CEditView?
Regards, George
|
|
|
|
 |
|
 |
gwayland wrote:
Any tips on how this could be used in a CEditView?
At the moment no...sorry...however I shall include those instructions in the next update (if I can figure it out that is ).
Not knowing what I was getting into as of now, I would probably just subclass the CEdit returned by GetEditCtrl()???
gwayland wrote:
You might consider using ON_CONTROL_REFLECT_EX(EN_CHANGE, OnChange) and returning FALSE from OnChange to allow the parent dialog to still get the notification message.
Next update i'll do that I'm really stuck on my next pet project.
Thanks again for the suggestions
Cheers
How do I print my voice mail?
|
|
|
|
 |
|
 |
Just what the doctor ordered - you got my 5!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
 |