in

C1 Community

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

Editor over Grid

Last post 11-15-2007 3:16 AM by Qbert79. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-14-2007 9:22 AM

    Editor over Grid

    In my application i need to have a editor of the cell out of the grid cell. I do this using SetupEditor event:

    private void tdbPlayList_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e){

    TextBox tb = tdbPlayList.Editor as TextBox;

    tb.Location = new Point(tb.Location.X - ((55 - tdbPlayList.Cols[e.Col].WidthDisplay) / 2), tb.Location.Y - tb.Size.Height);

    tb.Size = new Size(55, 18);

    }

    My problem is that i can't see the value in the cell. For me is very usefull have the "old" value visible in the cell and the editor field up.

    I'm  using C1flexgrid 2.6

    Thanks oin advance for your help.

     

     

  • 11-14-2007 12:07 PM In reply to

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

    Re: Editor over Grid

    Here's an idea: you can use a label and modify it when you set up the editor.  Add a label to the form (label1), make it look like your grid (backcolor, font color, etc), then set visible = false.

    private void tdbPlayList_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e){

    TextBox tb = tdbPlayList.Editor as TextBox

    if(tdbPlayList[e.Row, e.Col] != null)
    {
          label1.Text = tdbPlayList[e.Row, e.Col].ToString();

    label1.Location =
    new Point(tb.Location.X + 2, tb.Location.Y + 3);
    label1.Size =
    new Size(tdbPlayList.Cols[e.Col].WidthDisplay, 18);
    label1.Visible =
    true;

    tb.Location = new Point(tb.Location.X - ((55 - tdbPlayList.Cols[e.Col].WidthDisplay) / 2), tb.Location.Y - tb.Size.Height);
    tb.Size = new Size(55, 18);
    }

    then after editing, make the label go away

    private void tdbPlayList_AfterEdit(object sender, RowColEventArgs e)
    {
    label1.Visible =
    false;
    }

    Hope that helps,
    Greg L

    Filed under: ,
  • 11-15-2007 3:16 AM In reply to

    Re: Editor over Grid

    Thanks Greg!

    it seems to be run perfectly for my needed. Only a little question: This solution is a workaround! Is there another "normal" solution ? Please, keep in mind that with version 1.0 of flexy grid my needes are soddisfied by default fr0m the grid.

    Thanks Again,

    Daniele

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