Rich Text Box SelStart with text > 32Kbytes 
Author Message
 Rich Text Box SelStart with text > 32Kbytes

Quote:

>I have been having problems using SelStart with text greater
>than 32Kbytes in length. Specifically, attempts to set SelStart
>to locations beyond 32K seem to act as if SelStart was being
>caste as a 16 bit signed integer. Negative numbers wrap to the
>end of the text, and positive numbers alias to somewhere within
>the first 32K.
>Microsoft does acknowledge that this is a bug.
>Does anybody have a workaround or solution that would allow
>a text box with scrollbars, non-hideable selection, and large
>text files ? I don't need all the fancy embedded graphics or
>multiple font support, I just need a text box that works with
>really big text things.

Here is my workaround:

Sub PositionSetzen(ByVal Stelle As Long)

   Dim gef As Boolean

   gef = False
   txt(AF).SetFocus
   If txt(AF).SelStart = Stelle Then Exit Sub
   If Stelle < 32700 Then
      txt(AF).SelStart = Stelle
      Exit Sub
   End If

   If Abs(txt(AF).SelStart - Stelle) > 200 Then
      If txt(AF).SelStart < Stelle Then
         While gef = False
            SendKeys "{DOWN}", 1
            DoEvents
            If txt(AF).SelStart >= Stelle Then gef = True
         Wend
      Else
         While gef = False
            SendKeys "{UP}", 1
            DoEvents
            If txt(AF).SelStart <= Stelle Then gef = True
         Wend
      End If
   End If

   While txt(AF).SelStart <> Stelle
      If txt(AF).SelStart < Stelle Then
         SendKeys "{RIGHT}", 1
         DoEvents
      Else
         SendKeys "{LEFT}", 1
         DoEvents
      End If
   Wend

End Sub

change txt(AF) to your controlname.

Hope this helps

Rainer



Sun, 04 Apr 1999 03:00:00 GMT  
 Rich Text Box SelStart with text > 32Kbytes


Quote:

>I have been having problems using SelStart with text greater
>than 32Kbytes in length. Specifically, attempts to set SelStart
>to locations beyond 32K seem to act as if SelStart was being
>caste as a 16 bit signed integer. Negative numbers wrap to the
>end of the text, and positive numbers alias to somewhere within
>the first 32K.

>Microsoft does acknowledge that this is a bug.

>Does anybody have a workaround or solution that would allow
>a text box with scrollbars, non-hideable selection, and large
>text files ? I don't need all the fancy embedded graphics or
>multiple font support, I just need a text box that works with
>really big text things.



    You need to do this:

        Type CharRange
                MinIndex As Long
                MaxIndex As Long
        End Type

        Global C_Range As CharRange

    ' To enable the part past 32K ( up to 1000000 or whatever you want)

    Call SendMessageA(RtBox.hWnd, EM_EXLIMITTEXT, 0, 1000000)

    ' Set the C_Range values
    C_Range.MinIndex = start_index
    C_Range.MaxIndex = start_index + Selected_length

    I = SendMessageA(RtBox.hWnd, EM_EXSETSEL, 0, C_Range)

   That should do it

Mark



Mon, 05 Apr 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. rich text box SelStart with text > 32K

2. selStart property of Rich Text Box control

3. selStart property in Rich Text Box Control

4. Rich Text Box: Can I remove text and keep multicolored text

5. Colour Text Box/Class Wrapper for Rich Text Box

6. Newbie question: Rich Text Box vs. Text Box

7. help: formatting rich text box/text box

8. Rich Text Box vs. Text Box Scrolling

9. Rich Text Box or text box control

10. Looking for APIs for text box and Rich text box

11. Help - MS Rich Text and SelStart, SelLength BUG???

12. clipboard -> rich text box

 

 
Powered by phpBB® Forum Software