in

C1 Community

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

Pressing ENTER key when c1truedbgrid has a dropdown embedded

Last post 05-22-2008 10:51 AM by C1_SamX. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-16-2008 8:33 AM

    Pressing ENTER key when c1truedbgrid has a dropdown embedded

    I am facing 2 issues in TrueDBGrid, and did not find any post regarding them -

    1st issue:

    pressing enter key in c1truedbgrid when c1TrueDBdropdown is open then focus does not go to next row. On 1st ENETR it closes dropdown and user has to press one more ENTER in order to move to next row.

    I have this code:

    this.grdData.Splits[0].DisplayColumns["GRD_ITEM"].AutoComplete = true;
    this.grdData.Splits[0].DisplayColumns["GRD_ITEM"].AutoDropDown = true;
    this.grdData.Splits[0].DisplayColumns["GRD_ITEM"].Button = true;
    this.grdData.DirectionAfterEnter = C1.Win.C1TrueDBGrid.DirectionAfterEnterEnum.MoveDown;

    Now when I run the app, and start typing in column everything works great. Problem is when I press enter on column that have c1TrueDBdropdown. I have code that set values in other column of grid based on user selection from dropdown list and that code is written in ComboSelect event. As per the client requirement on pressing enter cursor should move to next row after validating correct selection in GRD_ITEM column.

    I have this code in BeforeColUpdate event: (c1TrueDBdropdown name = c1ItemDP & c1TrueDBGrid name = grdData)

    if(e.Column.Name == "GRD_ITEM")
    {
     if(this.c1ItemDP.GetCurrentSelIndex()<0)
          {
           MessageBox.Show("Please select a valid item from the list","Warning",MessageBoxButtons.OK,MessageBoxIcon.Warning);
           e.Cancel=true;
          }
    }

    To resolve the issue of ENTER key on dopdown column I wrote code in KeyUp event of grid:

    if(this.grdData.Col == this.grdData.Columns.IndexOf(this.grdData.Columns["GRD_ITEM"]))   {
        if(e.KeyCode == System.Windows.Forms.Keys.Enter)      this.grdData.Row+= 1;
      }

    Problem in this logic is when user is not changing item in GRD_ITEM column and pressing enter to navigate. Now when user press enter in 1st row he moves to 3rd row and so on.

    Thought about writing code to move to next row in other events, but problem is I will not know if user pressed ENTER or other key like TAB. On TAB user should move right not down. Is this a bug in C1TrueDBGrid?

    2nd Issue: Loosing AutoComplete and AutoDropDown functionality. When user type in column with dropdown emebedded then one first try it works great. Dropdown will complete user input if matched and dropdown does drop. But try doing these actions:

    1. type value in column that does not match dropdown list value. You will see c1truedbdropdown drops and  tries to complete your entry.

    2. Now Press ENTER key, so dropdown will close

    3. Using your backspace key remove all values from your column. And now start typing again. You will see the problem. Drop down will not open automatcially now and even autocomplete will not work. Are these bugs in C1TrueDBGrid??

    Thanks

  • 05-22-2008 10:51 AM In reply to

    Re: Pressing ENTER key when c1truedbgrid has a dropdown embedded

    Hi,
    This indeed seems bug to me.
    Please send a query directly to support@componentone.com so that we can check these issues further at our end.
    Regards,
    Sam Xavier
     
    <miamiman21> wrote in message news:204936@10.0.1.98...

    I am facing 2 issues in TrueDBGrid, and did not find any post regarding them -

    1st issue:

    pressing enter key in c1truedbgrid when c1TrueDBdropdown is open then focus does not go to next row. On 1st ENETR it closes dropdown and user has to press one more ENTER in order to move to next row.

    I have this code:

    this.grdData.Splits[0].DisplayColumns["GRD_ITEM"].AutoComplete = true;
    this.grdData.Splits[0].DisplayColumns["GRD_ITEM"].AutoDropDown = true;
    this.grdData.Splits[0].DisplayColumns["GRD_ITEM"].Button = true;
    this.grdData.DirectionAfterEnter = C1.Win.C1TrueDBGrid.DirectionAfterEnterEnum.MoveDown;

    Now when I run the app, and start typing in column everything works great. Problem is when I press enter on column that have c1TrueDBdropdown. I have code that set values in other column of grid based on user selection from dropdown list and that code is written in ComboSelect event. As per the client requirement on pressing enter cursor should move to next row after validating correct selection in GRD_ITEM column.

    I have this code in BeforeColUpdate event: (c1TrueDBdropdown name = c1ItemDP & c1TrueDBGrid name = grdData)

    if(e.Column.Name == "GRD_ITEM")
    {
     if(this.c1ItemDP.GetCurrentSelIndex()<0)
          {
           MessageBox.Show("Please select a valid item from the list","Warning",MessageBoxButtons.OK,MessageBoxIcon.Warning);
           e.Cancel=true;
          }
    }

    To resolve the issue of ENTER key on dopdown column I wrote code in KeyUp event of grid:

    if(this.grdData.Col == this.grdData.Columns.IndexOf(this.grdData.Columns["GRD_ITEM"]))   {
        if(e.KeyCode == System.Windows.Forms.Keys.Enter)      this.grdData.Row+= 1;
      }

    Problem in this logic is when user is not changing item in GRD_ITEM column and pressing enter to navigate. Now when user press enter in 1st row he moves to 3rd row and so on.

    Thought about writing code to move to next row in other events, but problem is I will not know if user pressed ENTER or other key like TAB. On TAB user should move right not down. Is this a bug in C1TrueDBGrid?

    2nd Issue: Loosing AutoComplete and AutoDropDown functionality. When user type in column with dropdown emebedded then one first try it works great. Dropdown will complete user input if matched and dropdown does drop. But try doing these actions:

    1. type value in column that does not match dropdown list value. You will see c1truedbdropdown drops and  tries to complete your entry.

    2. Now Press ENTER key, so dropdown will close

    3. Using your backspace key remove all values from your column. And now start typing again. You will see the problem. Drop down will not open automatcially now and even autocomplete will not work. Are these bugs in C1TrueDBGrid??

    Thanks



    http://helpcentral.componentone.com/cs/forums/p/75272/204936.aspx#204936

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