Export (0) Print
Expand All

How to: Provide Hidden Text Support

You can create hidden text regions in addition to outline regions. Hidden text regions can be client-controlled or editor-controlled and are used to hide a region of text completely. The editor displays a hidden region as horizontal lines. An example of this is the Script Only view in the HTML editor.

To implement a hidden text region

  1. Call QueryService for SVsTextManager.

    This returns a pointer to IVsHiddenTextManager.

  2. Call GetHiddenTextSession, passing in a pointer for a given text buffer. This determines whether a hidden text session already exists for the buffer.

  3. If one already exists, then you do not need to create one and a pointer to the existing IVsHiddenTextSession object is returned. Use this pointer to enumerate and create hidden text regions. Otherwise, call CreateHiddenTextSession to create a hidden text session for the buffer.

    A pointer to the IVsHiddenTextSession object is returned.

    Note Note

    When you call CreateHiddenTextSession, you can specify a hidden text client (that is, IVsHiddenTextClient). The hidden text client notifies you when hidden text or outlining is expanded or collapsed by the user.

  4. Call AddHiddenRegions to add one or more new outline regions at a time, specifying the following information in the reHidReg (NewHiddenRegion) parameter:

    1. Specify a value of hrtConcealed in the iType member of the NewHiddenRegion structure to indicate that you are creating a hidden region, rather than an outline region.

      Note Note

      When concealed regions are hidden, the editor automatically displays lines around the hidden regions to indicate their presence.

    2. Specify whether the region is client-controlled or editor-controlled in the dwBehavior members of the NewHiddenRegion structure. Your smart outlining implementation can contain a mix of editor- and client-controlled outline and hidden text regions.

Show:
© 2014 Microsoft