Page 1 of 1

No OnCurTextStyleChanged() if rvprDoNotAutoSwitch

Posted: Thu Dec 08, 2005 9:39 pm
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

Posted: Sat Dec 10, 2005 1:06 pm
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)

Posted: Sat Dec 10, 2005 7:35 pm
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

Posted: Sun Dec 11, 2005 7:56 pm
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.

Posted: Sun Dec 11, 2005 9:25 pm
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