Text Selection / Change Newbie Question

  • HI,
    I just started playing with the .Net TextDynamics control a few hours ago. It looks great.
    I have a very simple question, but I don't seem to be able to figure it out. If someone could point me in the right direction I would really appreciate it.

    I need to do the following:
    1. User selects some text.
    2. User presses command button elsewhere on the form
    3. I need to move the selected text to another instance of the control and replace the original with some new text.

    I can replace the selected text with:
    Me.EditorBase.TextCursor.InputText(s) 'EditorBase is the WPDLInt
    Me.EditorBase.Reformat()
    However, I don't know how to retrieve the selected text. In some cases I will need it with all formatting, and in other cases I need just the raw text - no formatting.

    On another note - I am wrapping the control in a user control in order to implement my own interface. A number of these, potentally 4-8 may be displayed at one time (the user is working on multiple documents). Can anyone think of any problems I might encounter in such a scenario?

    Thanks a lot. It looks like a great control.

    • Offizieller Beitrag

    Hi,

    Code
    1. User selects some text. 2. User presses command button elsewhere on the form 3. I need to move the selected text to another instance of the control and replace the original with some new text.

    Here is an example developed in VB6 (VB.NET would work the same):

    Code
    Private Sub Command1_Click()  Dim str As String  str = WPDLLInt1.CurrMemo.SelText  WPDLLInt2.CurrMemo.SelText = strEnd Sub

    The format which is saved to the string str using the proprty SelText is RTF. You can also use the function SaveToString which can convert all text to a string and you can also seölect the format "ANSI", "RTF", "HTML" or "WPT" (WPT is its own format, looks like HTML)

    Code
    Private Sub Command1_Click()
      Dim str As String
      str = WPDLLInt1.CurrMemo.SaveToString(True, "WPT")
      WPDLLInt2.CurrMemo.LoadFromString(str, True, "AUTO")
    End Sub

    The format string using with SaveToString and LoadFromString can also have options, such as "RTF-onlybody" or "RTF-nomergefields". A list is available at http://www.wpcubed.com/manuals/formatstrings.htm

    Zitat

    On another note - I am wrapping the control in a user control in order to implement my own interface. A number of these, potentally 4-8 may be displayed at one time (the user is working on multiple documents). Can anyone think of any problems I might encounter in such a scenario?

    I haven't done anything so far with user controls. Having multiple instances is no problem. I would not expect problems, if there are any, please send a sample project to support@wptools.de and we work it out.

    Regards,

    Julian Ziersch