Results 1 to 40 of 4199

Thread: CommonControls (Replacement of the MS common controls)

Hybrid View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    I think it is difficult to help you more without seeing the code in your UserControl.
    I have tested your scenario within a blank UserControl and everything seems to work.

  2. #2
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    127

    VBCCR RichTextBox Issues

    Hi Krool,

    Ive been using the RichTextBox from ActiveX control Version 1.7. (win 10 64 bit)
    In the MS version of rtb i could set
    Code:
    rtb.selstart = Len(rtb.text)
    and then compare equal would be true
    Code:
    If rtb.SelStart = Len(rtb.Text) Then  '<-- = True
    however, with this rtb its behavior is different from
    the MS version.

    Ive done some investigating and it appears the Len(rtb.Text) includes CR-LF per line in length
    but rtb.SelStart doesnt not include calculations for CR-LF line endings.
    Below is a screenshot showing results of test. Would it be possible to get the same behavior as MS control?
    Regards,
    Lewis

    (not sure why its so small)
    here is link to image: https://imgur.com/a/eFrOmRB

    Name:  rtb.jpg
Views: 4846
Size:  27.1 KB
    Last edited by vbLewis; Oct 10th, 2021 at 06:00 PM. Reason: clarify crlf line ending

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBCCR RichTextBox Issues

    Quote Originally Posted by vbLewis View Post
    Hi Krool,

    Ive been using the RichTextBox from ActiveX control Version 1.7. (win 10 64 bit)
    In the MS version of rtb i could set
    Code:
    rtb.selstart = Len(rtb.text)
    and then compare equal would be true
    Code:
    If rtb.SelStart = Len(rtb.Text) Then  '<-- = True
    however, with this rtb its behavior is different from
    the MS version.

    Ive done some investigating and it appears the Len(rtb.Text) includes CR-LF per line in length
    but rtb.SelStart doesnt not include calculations for CR-LF line endings.
    I hate this quirk and it was discussed several times already.

    So, to sum up. We have SelStart and SelLength and SelText (using the EM_GETSELTEXT, rich edit message only) all ignoring CR-LF and just uses CR.
    The only "annyoing" part is the Text property which will use EM_STREAMOUT. And this EM_STREAMOUT put out CR-LF.
    So, I could "fix" the Text property by using EM_GETTEXTEX which only returns CR (unless GT_USECRLF is used).

    However, additional quirk is that EM_STREAMOUT does not output "hidden" text. This could be fixed additionally by using GT_NOHIDDENTEXT flag. (but this exists only as of rich edit version 4, thus leaving 2 and 3 in the dark...)

    So, all in all it's a shame...
    Or I replace all CR-LF to CR only within EM_STREAMOUT.. However, this would be an additional memory allocation exchange for the text.

    Edit: the MS rtb uses the v1 which uses CR+LF internally.
    Last edited by Krool; Oct 11th, 2021 at 09:41 AM.

  4. #4
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    127

    Re: VBCCR RichTextBox Issues

    Quote Originally Posted by Krool View Post
    I hate this quirk and it was discussed several times already.

    So, to sum up. We have SelStart and SelLength and SelText (using the EM_GETSELTEXT, rich edit message only) all ignoring CR-LF and just uses CR.
    The only "annyoing" part is the Text property which will use EM_STREAMOUT. And this EM_STREAMOUT put out CR-LF.
    So, I could "fix" the Text property by using EM_GETTEXTEX which only returns CR (unless GT_USECRLF is used).

    However, additional quirk is that EM_STREAMOUT does not output "hidden" text. This could be fixed additionally by using GT_NOHIDDENTEXT flag. (but this exists only as of rich edit version 4, thus leaving 2 and 3 in the dark...)

    So, all in all it's a shame...
    Or I replace all CR-LF to CR only within EM_STREAMOUT.. However, this would be an additional memory allocation exchange for the text.

    Edit: the MS rtb uses the v1 which uses CR+LF internally.
    Hi Krool,
    Thanks for your reply. Sorry I wasnt aware others had brought it up already, I thought I was reporting a good bug LOL. Its fine if the behavior is an unintended consequence of upgrading to new api.
    I Fixed my problem by using API to get Text length to compare to SelStart and it works very well.

    Maybe a non-standard function like .GetTextLength(optional param,optional param) would be a solution?

    regards,
    lewis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width