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


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

Re: RichEdit control question

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups comp.lang.basic.visual.misc
Subject Re: RichEdit control question
Date 2011-10-17 17:19 -0400
Organization A noiseless patient Spider
Message-ID <j7i5sf$7ng$1@dont-email.me> (permalink)
References (2 earlier) <j7c6m8$8fo$1@dont-email.me> <vnfj97h4j946qd1mbkhvfmm6s6f9vqr2df@4ax.com> <j7cno4$mac$1@dont-email.me> <01cc8b90$69e63db0$6d01a8c0@k8s8x> <j7fvs7$uu7$1@dont-email.me>

Show all headers | View raw


 OK, I got curious and did this. It's actually fairly
simple.

  Here's a basic sample that works in VB. Hopefully
you can translate it to .Bloat. As I was working on it
I wondered how one would make text visible again.
How do you know what text it is? You can't select
invisible text. I don't know whether a hidden word has
a character index. For instance:

"The quick brown fox"

quick begins at character index 4 and goes to index
8. If I hide "quick", is it still at index 4, or is the space
before "brown" at index 4? If the latter, then how do I
find hidden text? If the former then how do I accurately
handle finding the caret position in the window, etc.?

 I don't know. I'll leave that issue to you. The way I did it
here, for the sake of the demo, is that one sub can hide
selected text or unhide all hidden text. You should be able
to use EM_GETCHARFORMAT to find out whether given text
is hidden, but as detailed above, I'm not sure how that
plays out.

  This sample was written in VB with a system-drawn
RichEdit v. 3 window. It won't work with a VB RTB. Maybe it
works with a VB.Net RTB? I don't know if VB.Net even has
an RTB. ?? One would hope they could put a basic RTB in
that 1/2 GB of support file slop that .Bloat requires...

   In any case, the RTB would need to be derived from
a RichEdit window and it would need to be using v. 3 or
later. (Some references say hidden text is available in
v. 2. In any case, v. 3 is available even in Win98 when one
creates a "RichEdit20A" from RICHED20.DLL. That DLL name
is the same for v. 2 and v. 3 for the sake of compatibility.
... So you shouldn't need to worry about 2 vs 3.)

  I'll leave the constants declarations and such to you.
The following would be the VB6 code:

'--------------------------------------------
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
'----------------------------------------------

To hide currently selected text: HideText True
To unhide all hidden text in the window: HideText False

  As you can see, the actual method is not really very
complex. It just can't be done with a VB RTB because that
wraps RichEdit v. 1. Can .Bloat handle system-drawn
windows? I don't know. If not, and if it doesn't have a
usable RTB -- and if you know VB -- you could download
the RTB from vbaccelerator, edit that code to include
the hidden functionality, then compile it. (The vbaccelerator
sample also provides all the declarations, if you need those.) 

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