Home Forums General XMetaL Discussion Highlighting and coloring text Reply To: Highlighting and coloring text


Reply to: Highlighting and coloring text

Thank you guys. Works like a charm.

Just a couple hints (in case anyone else wants to do the same thing):

For the macros which process the whole document (On_Document_Open_Complete and On_View_Change) it is a good idea to use the MoveToDocumentStart() function in the end again. Otherwise the user sees the last colored element rather than the document's beginning.

In the On_View_Change macro is is useful to check not only the current view but also the previous one.
As Tom pointed out the colors remain active when the user switches between Normal View and TagsOn View.
Processing the document in this situation would not only have a negative impact on performance (depending on size of document and amount of processed elements) but would unnecessarily move the selection away from where the user put it.

[code]if(ActiveDocument.PreviousViewType >= 2 && ActiveDocument.ViewType <= 1) {
    SetColors(“colorFont”, “color”);
    SetColors(“colorBack”, “background-color”);