in

C1 Community

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

Cell Editor Wordwrap

Last post 11-30-2007 3:48 PM by C1_GregL. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-30-2007 1:34 PM

    • mharo
    • Top 50 Contributor
    • Joined on 03-22-2006
    • Posts 71

    Cell Editor Wordwrap

    Is there any way while the user is entering data into the grids cell editor
    to automatically expand the editor box either horizontally or vertically
    (based on a Word-wrap property) as they type? Currently as the user types
    the text scrolls off to the left so if they are entering a large amount of
    text they can't see what they have already typed in without having to use
    the arrow keys moving the insertion mark back through the text typed to see
    it.

    We handle the word wrapping of the row afterwards but I've had this request
    and don't see anyway to do it during the actual key entry.
  • 11-30-2007 3:48 PM In reply to

    • C1_GregL
    • Top 10 Contributor
    • Joined on 06-11-2007
    • Pittsburgh PA
    • Posts 500

    Re: Cell Editor Wordwrap

    You can try to work with these events: SetupEditor and ChangeEdit.

    For example, the code below will set the editor to the height of the row.  This would be handy if you were about to edit multiline text with wordwrap.  This doesn't adjust the height as keys are typed, however.  This also is dependent on whether the editor's height can be set.  You might have to set the editor's height a little bigger than the rows height.

    Private Sub C1FlexGrid1_SetupEditor(ByVal sender As System.Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles C1FlexGrid1.SetupEditor

    If C1FlexGrid1.Rows(e.Row).Height > -1 And e.Col = 1 Then
      
    C1FlexGrid1.Cols(e.Col).Editor.Height = C1FlexGrid1.Rows(e.Row).Height
    End If

    End Sub

    The ChageEdit event is called after each key is pressed while in the editor, which could be useful but I don't have any sample to expand the editor while editing.

    Regards,
    Greg L

    Filed under: ,
Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.