Setting Focus to ScaleRichView

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Setting Focus to ScaleRichView

Post by Jim Knopf »

Hello Sergey,
I work with ScaleRichviewEdit V 9.01 and unfortunately I can't upgrade because then basic things don't work.

It's about two controls, rv (TRichViewEdit) and srv (TSRichViewEdit).
Because I want to optionally switch between the two, rv is integrated externally with srv.ExternalRV := rv. The switching works perfectly.
My question is about the situation where rv is used as an external control of srv, so srv is the current write area.

When a user jumps into srv with a keyboard shortcut, I want the cursor to already be flashing at a certain position.
With rv this is no problem: SetSelectionBounds and then rv.SetFocus.
With srv.SetFocus the cursor does not blink at the set position, it looks like srv does not have the focus. When I check with Screen.ActiveControl, rv is indeed the active control.

How can I set the focus in the srv so that the cursor flashes there?

Best regards
Martin
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Setting Focus to ScaleRichView

Post by Sergey Tkachenko »

Sorry, ExternalRV property never worked properly (maybe except for very early versions of ScaleRichView), and finally it was removed in ScaleRichView v11.
I do not recommend using this property. I you need to switch between editors, copy document from one to another.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Re: Setting Focus to ScaleRichView

Post by Jim Knopf »

First I tried with ActiveEditor, but unfortunately OnSpellingCheckEx does not work there, which I need for the integration of the Duden corrector.
I had to 'free' OnSpellingCheckEx at the time with rv, which worked very well. Now I have tried it this way, which unfortunately does not work:

Code: Select all

srv.ActiveEditor.OnSpellingCheckEx := rvSpellingCheckEx;
Copying the document is no problem, but without the Duden corrector it is a knock-out criterion.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Setting Focus to ScaleRichView

Post by Sergey Tkachenko »

What does not work exactly?
Does this event exist? (it exists only if the code is compiled with RVLIVESPELLEXEVENT compiler $define).
Or it exists but is not called?

Is there a reason for using this event instead of the standard OnSpellingCheck event?
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Re: Setting Focus to ScaleRichView

Post by Jim Knopf »

We need the event because we need the item and position to deactivate errors locally.

But it works anyway, I just overlooked one little thing, as I just found out. It would have been nice with the external rv, because this way I have to introduce a global variable in about 700 places in 50 units ...

Thanks for your help and have a nice weekend!
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Setting Focus to ScaleRichView

Post by Sergey Tkachenko »

In the next update, I'll add OnSpellingCheckEx event to TSRichViewEdit.
Post Reply