in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Autoscroll to selected spellcheck word within multiline textbox

Last post 10-10-2006 2:37 AM by C1_SergeiS. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-25-2006 2:45 PM

    Autoscroll to selected spellcheck word within multiline textbox

    I'm having a problem where I have a multiline textbox with alot of text in it.  When there's alot of text in the control it will create a scroll bar for you to scroll around. When spell checking words that are off the screen, it doesn't automatically scroll to the selected spell check word.  There is no way to implement the SelectCaret method because the cursor is within the spell check dialog.  I wonder if this is something that can be fixed in the next release, where when selecting text in a multiline textbox that is off the visible area, the spell check control will set the SelectCaret method to autoscroll to the selected text before displaying the spell check dialog. 
  • 10-02-2006 7:31 PM In reply to

    Re: Autoscroll to selected spellcheck word within multiline textbox

    Hi,
     
    I could do this in BadWord event handler:
     
    private void c1Spell1_BadWord(object sender, C1.Win.C1Spell.BadWordEventArgs e)
    {
      textBox1.ScrollToCaret();
    }
     
    Did with C1Spell 1.2.20063.67
    Regards,
    Sergey.
    <pboilee> wrote in message news:186556@test.componentone.com...
    I'm having a problem where I have a multiline textbox with alot of text in it.  When there's alot of text in the control it will create a scroll bar for you to scroll around. When spell checking words that are off the screen, it doesn't automatically scroll to the selected spell check word.  There is no way to implement the SelectCaret method because the cursor is within the spell check dialog.  I wonder if this is something that can be fixed in the next release, where when selecting text in a multiline textbox that is off the visible area, the spell check control will set the SelectCaret method to autoscroll to the selected text before displaying the spell check dialog. 

    http://home.componentone.com/cs/forums/186556/ShowPost.aspx

  • 10-03-2006 12:10 PM In reply to

    Re: Autoscroll to selected spellcheck word within multiline textbox

    Thanks but that did not work for me, the code is okay but it didn't do what I wanted to do.  That is to scroll to the selected text that the spell check has selected as the current word being spell checked.  My problem is that when spell checking words within a multiline text box with scroll bars, if the word is located off the visible area of the multi text box then spell check doesn't auto scroll to it even though spell check is doing the spell checking on that word.  The code you provided above would work if the caret cursor was at the selected text but it's not.  Looks like spell check just highlights the word, fires badword event if any and throws the spell check dialog up.
  • 10-10-2006 2:37 AM In reply to

    Re: Autoscroll to selected spellcheck word within multiline textbox

    Hi,
     
    hmmm... here is what I do. I put a textbox to a form and make it multiline. Then I put correct text into textbox and append incorrect word to the text, so bad word is out of visible area. Enable scrollbar. Make a check.
    When incorrect word is encountered, BadWord event is fired, then textbox is scrolled to this word, then BadWordDialog is shown.
     
    Sample is simple, contains C1Spell, button and textbox on a form. Below is the code:
     
    private void button1_Click(object sender, EventArgs e)
    {
      c1Spell1.CheckControl(textBox1);
    }
     
    private void c1Spell1_BadWord(object sender, C1.Win.C1Spell.BadWordEventArgs
    e)
    {
     textBox1.ScrollToCaret();
    }
     

    TextBox settings:
     
    private void InitializeComponent()
    {
      ...
      this.textBox1.Location = new System.Drawing.Point(13, 13);
      this.textBox1.Multiline = true;
      this.textBox1.Name = "textBox1";
      this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
      this.textBox1.Size = new System.Drawing.Size(140, 60);
      this.textBox1.TabIndex = 0;
      this.textBox1.Text = "good good good good good good good good good good
    good good good good good good good good good good good good good good good
    good good good good good good good good good good good good good good good
    good good badd badd good";
      ...
    }
    Regards,
    Sergey.
     
    P.S. What version of C1Spell do you use?
     
    <pboilee> wrote in message news:186992@test.componentone.com...
    Thanks but that did not work for me, the code is okay but it didn't do what I wanted to do.  That is to scroll to the selected text that the spell check has selected as the current word being spell checked.  My problem is that when spell checking words within a multiline text box with scroll bars, if the word is located off the visible area of the multi text box then spell check doesn't auto scroll to it even though spell check is doing the spell checking on that word.  The code you provided above would work if the caret cursor was at the selected text but it's not.  Looks like spell check just highlights the word, fires badword event if any and throws the spell check dialog up.

    http://home.componentone.com/cs/forums/186946/ShowPost.aspx#186992

Page 1 of 1 (4 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.