Results 1 to 6 of 6

Thread: SelStart / SelLength like feature in DHTMLEdit / Webbrowser Control

  1. #1

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Arrow SelStart / SelLength like feature in DHTMLEdit / Webbrowser Control

    How can I add a SelStart/SelLength like feature in DHTMLEdit/Webbrowser control ? Any idea ?
    Last edited by iPrank; Feb 9th, 2006 at 06:37 AM.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  2. #2
    Addicted Member
    Join Date
    Jan 2006
    Posts
    248

    Re: SelStart / SelLength like feature in DHTMLEdit / Webbrowser Control

    http://msdn.microsoft.com/library/de...commandids.asp

    You can use the execCommand to select text.

    Also see:
    http://msdn.microsoft.com/library/de...etextrange.asp

    http://msdn.microsoft.com/library/de..._textrange.asp

    http://msdn.microsoft.com/library/de...ce/methods.asp


    You also could use VB selStart and SelLength if you copy the page's text to a rich text control.

    Mike

  3. #3

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: SelStart / SelLength like feature in DHTMLEdit / Webbrowser Control

    Thanks Mike.

    I have never used textRange , and my JavaScript $ucks. Could you please post some VB/C++ code example ?

    I'm making a WYSIWYG HTML editor for my iRead, so that it can read web pages too. (without loosing formatting and picture).

    I need to use the SelStart/SelLength like features so that it can be integrated with my current RTB word highlighter code (and many other) without much hassle.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  4. #4

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: SelStart / SelLength like feature in DHTMLEdit / Webbrowser Control

    I have managed to create the textRange and able to get the text. But I don't understand how I get current textRange ? Also how to stepthrough each charecter in a textRange ?

    VB Code:
    1. '**********************************************************
    2. Private m_SelStart As Long
    3. Private m_SelLength As Long
    4. '**********************************************************
    5. Public Property Get Text() As String
    6.     On Error Resume Next
    7.     Dim txtrng As Object
    8.     Set txtrng = DHTMLEdit1.DOM.body.createTextRange
    9.     Text = txtrng.Text
    10. End Property
    11.  
    12. Public Property Let Text(ByVal Value As String)
    13.    'How to detect active textRange ?
    14. End Property
    15.  
    16. '**********************************************************
    17.  
    18. Public Property Get SelLength() As Long
    19.     'How to detect active textRange ?
    20. End Property
    21.  
    22. Public Property Let SelLength(ByVal Value As Long)
    23.     'How to detect active textRange ?
    24. End Property
    25.  
    26. '**********************************************************
    27.  
    28. Public Property Get SelStart() As Long
    29.     'How to detect active textRange ?
    30. End Property
    31.  
    32. Public Property Let SelStart(ByVal Value As Long)
    33.     'How to detect active textRange ?
    34. End Property
    35. '**********************************************************
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5
    Addicted Member
    Join Date
    Jan 2006
    Posts
    248

    Re: SelStart / SelLength like feature in DHTMLEdit / Webbrowser Control

    Your making a control?

    I suggest working out the individual code in a normal exe so you can see it running.
    Personally I still think the easiest way is to copy all text to a rich text box and then use selstart and sellength.

    Mike

  6. #6

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: SelStart / SelLength like feature in DHTMLEdit / Webbrowser Control

    Yes. I'm making a control. I think that way it will be easier to merge with existing code.

    The most inportant reasons I started writing iRead is,
    1. My current TTS software ($29.95 !!!) can't read formated document [rtf - Done, pdf - I have an idea, html - ?].
    2. That s/w doesn't save the position where it left off. [Done]
    3. Doesn't auto scrolls. [Done]
    4. Doesn't gray-out readen text [Done]
    5. Can't go to full screen mode. [Almost done. Thanks to Bushmobile.]
    6. Can't remember zoom setting. [Done]
    7. Doesn't integrate with browser. [I have done similar thing. Need to know more JS]

    So, just copying text to RTB is not an option. It will loose all formatting and images. Currently it does similar.

    I have attatched the control I'm making. It will be a very simple WYSIWYG HTML editor.
    Attached Files Attached Files
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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