No OnCurTextStyleChanged() if rvprDoNotAutoSwitch

General TRichView support forum. Please post your questions here
Post Reply
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

No OnCurTextStyleChanged() if rvprDoNotAutoSwitch

Post by Michel »

Hi Sergey,

RV 1.9.0.1. If text has a Style with Protection rvprDoNotAutoSwitch, OnCurTextStyleChanged() event does not fire when getting into or out of such text. Bug?

And while we're on this subject, there isn't any "dedicated" event that would fire when moving into a block of text that has some List Style, is there? Something similar to the above Text or the similar OnCurParaStyleChanged() events? If there isn't any, what event would you recommend: OnCaretMove()?

And what about detecting when the user gets into a table or "touches" one on the right or left side? I can see that RVActionTest enables/disables the "Delete Table" button when this happens, and furthermore, does the same to other table-related buttons when I actually "step into" a Cell, but I don't see any relevant events, and can't seem to figure out how RVActionTest does it. Could you please point me in the right direction?

Just to clarify: I do have the Actions source code, and I am not using Actions in my project.

Thank you,

Michel
Sergey Tkachenko
Site Admin
Posts: 17306
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

OnCurTextStyleChanged occurs when, well, the current text style (CurTextStyleNo property) is changed. No change - no event. And I think that user interface is not supposed to be changed in this case.

Yes, use OnCaretMove. For example, see Demos\Delphi\Assorted\ListStyles\Bullets\

For tables, GetCurrentItemEx (see Demos\Delphi\Editors\Editor 1\, items are disabled/enabled when the Table menu is shown).

RichViewActions use different approach. They update their state (Enabled and Checked properties) periodically when the application is idle (the Delphi's action system calls UpdateTarget of all actions)
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

Post by Michel »

If text has a Style with Protection rvprDoNotAutoSwitch, OnCurTextStyleChanged() event does not fire when getting into or out of such text.

OnCurTextStyleChanged occurs when, well, the current text style (CurTextStyleNo property) is changed. No change - no event.
I think I wasn't clear enough when I stated the problem I'm observing. Here's an example:
Text With Style 0 Text With Some Other Style That Also Happens To Be Protected With rvprDoNotAutoSwitch
Moving the carret between the two blocks of text above does not trigger the event. Note that the second block can have a very different style (Bold/Italic/etc., - in my specific case it is also a Hyperlink).

And regardless, even if the text was visually of the same style, but a part of it had some protection, that would make that protected part have a different style (CurTextStyleNo), no?

Hope I'm making more sense now.

As to my other questions: Cool, got it, thanks!

Thank you,

Michel
Sergey Tkachenko
Site Admin
Posts: 17306
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It is by design. Current text style (CurTextStyleNo property) is a text style which will be applied to the typed/pasted text. This event happens when value of this property is changed. And it is expected that, if you have editing UI, it shows attributes of this property. When the caret is moved to the protected text, CurTextStyleNo is not changed, event is not happen, UI is not changed.
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

Post by Michel »

Oh, I see... I understand now. I was misinterpreting the meaning of CurTextStyleNo and for once didn't fully read the Help :).

Thank you for clearing this up for me,

Michel
Post Reply