Enter Key and URL Detection

General TRichView support forum. Please post your questions here
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Post by Martian »

TRichView.UseStyleTemplates = False
Still can't find the problem :?
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Ok, we found that TerminateHyperlink is called.
Next question - is GetNonHypertextStyleNo called?
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Post by Martian »

On the first VK_RETURN GetNonHypertextStyleNo doesn't call but on the second - calls but doesn't close URL.

How RVE processes VK_RETURN? Maybe it intercepts it somewhere else?
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I do not understand your answer.
What is called and what is not called?
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Post by Martian »

When I press Enter after some URL for the first time - GetNonHypertextStyleNo does NOT calls and text style stays blue underlined.

If I press Enter again (cursor is on the next line after the URL already) - GetNonHypertextStyleNo CALLS but does not close URL style and on the 3rd line I still have blue underlined font.

Only after TAB or SPACE it works fine.
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am afraid I cannot help without a project reproducing the problem.
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Post by Martian »

I have no idea why this happens. I didn't change my code - just updated to a new RVE and problem is here. Tried everything (maybe not). Problem persists. And I'm not alone here, I didn't create this topic.
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This topic was created almost 4 years ago. And, actually, the problem was in using OnKeyPress.
For Enter, you need to use OnKeyDown.
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Post by Martian »

Yeah I know and posted my code with OnKeyDown. Still investigating...
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Post by Martian »

Still CANNOT fight this bug! RVE 14.7.1, Delphi XE4, Windows 7

Just try your Demos\DelphiUnicode\Assorted\Hypertext\CreateHyperlink demo - it has the same bug! Press ENTER after the "Hyperlink example".
Create new hyperlink and press ENTER.
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I confirm the problem, URL termination does not work on Enter if StyleTemplates are not used (if they are used, the component terminates kinks on Enter automatically).

It will be fixed in the next update.
A quick fix:
RVERVData.pas, TRVEditRVData.GetNextStyleNo, add the red lines:

Code: Select all

    // if styles are not used
    if (StyleNo=FCurTextStyleNo) and (TextStyle.NextStyleNo>=0) then
      Result := TextStyle.NextStyleNo
    [color=red]else
       Result := FCurTextStyleNo[/color];
    exit;
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Post by Martian »

Finally! It works. Thanks.
Post Reply