Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #509

Re: RichEdit control question

From Kalkidas <eat@joes.pub>
Newsgroups comp.lang.basic.visual.misc
Subject Re: RichEdit control question
Date 2011-10-17 17:34 -0700
Organization Aioe.org NNTP Server
Message-ID <j7iheb$455$1@speranza.aioe.org> (permalink)
References (5 earlier) <01cc8b90$69e63db0$6d01a8c0@k8s8x> <j7fvs7$uu7$1@dont-email.me> <j7i5sf$7ng$1@dont-email.me> <j7ibsd$eps$1@dont-email.me> <j7if8n$71l$1@dont-email.me>

Show all headers | View raw


On 10/17/2011 4:59 PM, Mayayana wrote:
> |>  '--------------------------------------------
> |>  Public Sub HideText(Hide As Boolean)
> |>     Dim LRet As Long
> |>     Dim CF2 As CHARFORMAT2
> |>       With CF2
> |>         .cbSize = 84
> |>         .dwMask = CFM_HIDDEN
> |>         If Hide = True Then .dwEffects = CFE_HIDDEN  '-- leave this out
> to
> |>  unhide.
> |>       End With
> |>
> |>       If Hide = True Then
> |>          SendMessageAny hRTB, EM_SETCHARFORMAT, SCF_SELECTION, CF2
> |>       Else
> |>          SendMessageAny hRTB, EM_SETCHARFORMAT, SCF_ALL, CF2
> |>       End If
> |>  End Sub
> |>  '----------------------------------------------
> |>
>
> | Interesting. SendMessageAny with CF2.dwmask set to CFM_Hidden and with
> | selection set to SCF_ALL does indeed globally un-hide all the hidden
> | words in the document.
> |
> | But what values will re-hide them? There must be a way.
> |
>
>   Re-hide "them"? The sub above will hide the current
> selected text. You have to use an SCF_* constant, so I
> guess it would be either SCF_SELECTION, or SCF_WORD.
> The latter might be easier. From the docs it sounds like
> you could hide any word by putting the SelStart inside
> a specific word and then using
>
> SendMessageAny hRTB, EM_SETCHARFORMAT, SCF_WORD, CF2
>
>     It does seem to be awkward keeping track, though. If
> you want to re-hide specific words I guess you'd have
> to either 1) hide them by searching for the actual word
> in the text or 2) maintain a list of the index of each word.
> But the former requires only hiding specific spellings, and the
> latter requires that you track all changes to the text in
> order to hold accurate offset values for the given words.
>
>    It might be easier to just parse/edit the actual RTF
> every time you want to make changes. You'd just have
> to find out what marker begins and ends hidden text.
> I guess it depends on exactly what you need to do.

I'll explain what I have. I have a large .rtf document interspersed with 
thousands of hidden strings of the form "<####>" where #### is a number. 
I hid the strings by doing a regex search for "<\d+>" and inserting the 
\v....\v0 rtf tags around them.

So when the document loads into the RichTextBox, the strings are all 
hidden.

Sending the WinAPI message: SendMessageAny(hRTB, EM_SETCHARFORMAT, 
SCF_ALL, CF2) with dw.mask set to CFM_HIDDEN (and dw.effects not set), 
almost instantaneously un-hides them. I doubt that it does this by 
individually searching for and deleting the thousands of \v...\v0 tags, 
but somehow makes them ignored, globally.

So the question is, what message to send to get the tags to be 
recognized again, thus re-hiding the strings?

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-10 14:41 -0700
  Re: RichEdit control question "Nobody" <nobody@nobody.com> - 2011-10-11 00:53 -0400
  Re: RichEdit control question BTIS Jeff <btisjb@gmail.com> - 2011-10-11 08:17 -0700
    Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-11 14:17 -0700
      Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-11 22:27 +0100
        Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-11 14:59 -0700
          Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-12 08:00 +0100
            Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-12 16:18 -0700
              Re: RichEdit control question Deanna Earley <dee.earley@icode.co.uk> - 2011-10-13 08:45 +0100
              Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-13 10:24 +0100
              Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-13 11:41 +0100
              Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-13 13:30 +0100
  Re: RichEdit control question Eric Coleman <eric@strategon.com> - 2011-10-13 19:55 -0500
    Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-14 09:30 +0100
    Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-15 07:53 -0700
      Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-15 17:03 +0100
      Re: RichEdit control question ralph <nt_consulting64@yahoo.net> - 2011-10-15 12:25 -0500
        Re: RichEdit control question ralph <nt_consulting64@yahoo.net> - 2011-10-15 12:29 -0500
        Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-15 12:45 -0700
          Re: RichEdit control question ralph <nt_consulting64@yahoo.net> - 2011-10-15 15:24 -0500
          Re: RichEdit control question "Thorsten Albers" <gudea@gmx.de> - 2011-10-15 23:16 +0000
            Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-16 18:21 -0700
              Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-16 23:15 -0400
              Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-17 17:19 -0400
                Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-17 15:59 -0700
                Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-17 19:59 -0400
                Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-17 17:34 -0700
                Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-17 23:46 -0400
                Re: RichEdit control question Kalkidas <eat@joes.pub> - 2011-10-18 07:35 -0700
                Re: RichEdit control question "Thorsten Albers" <gudea@gmx.de> - 2011-10-18 15:17 +0000
                Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-19 10:09 -0400
                Re: RichEdit control question "Mike Williams" <Mike@WhiskyAndCoke.com> - 2011-10-19 18:26 +0100
          Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-15 19:53 -0400
            Re: RichEdit control question "Thorsten Albers" <gudea@gmx.de> - 2011-10-16 03:32 +0000
              Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-16 12:02 -0400
                Re: RichEdit control question "Thorsten Albers" <gudea@gmx.de> - 2011-10-16 22:10 +0000
                Re: RichEdit control question "Mayayana" <mayayana@invalid.nospam> - 2011-10-16 19:17 -0400
                Re: RichEdit control question "Thorsten Albers" <gudea@gmx.de> - 2011-10-17 09:43 +0000

csiph-web