We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Overriding Keys

Thread ID:

Created:

Updated:

Platform:

Replies:

25415 Feb 25,2005 05:14 PM UTC Nov 15,2005 06:49 PM UTC Windows Forms 10
loading
Tags: Grouping
Anthony Avella
Asked On February 25, 2005 05:14 PM UTC

I''ve implemented the following code to allow the enter key to move the highlighted row down one row: public class DGridGroupingControl : GridGroupingControl { protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { try { if((keyData & Keys.KeyCode) == Keys.Tab ) { GridCurrentCell cc = this.TableControl.CurrentCell; GridTableCellStyleInfo style = this.TableControl.Model[cc.RowIndex, cc.ColIndex]; if(style != null && style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell) { Point p = this.TableControl.RangeInfoToRectangle(cc.RangeInfo).Location; int x_offset = ((keyData & Keys.Shift) == 0) ? this.TableControl.Model.ColWidths[cc.ColIndex] + 2 : - 2;//this.TableControl.Model.ColWidths[cc.ColIndex - 1] + 2; p.Offset(x_offset, 2); if(x_offset < 0 && cc.ColIndex == this.TableControl.LeftColIndex) this.TableControl.ScrollCellInView(cc.RowIndex, cc.ColIndex - 1); Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(this.TableControl, p); Console.WriteLine("ProcessCmdKey"); return true; } } else if((keyData & Keys.KeyCode) == Keys.Enter) { this.TableControl.CurrentCell.MoveDown(1); } I''m using this code for a grouped grid. The problem I have is when a user hits the enter key, the highlighted summary row is expanded and the next row under the expanded summary is shown and highlighted. The enter key will then move down each detail record with each hit of the key. I''d like the enter key to move the user down each visible row in the grid (in this case summary rows). How can I move down to the next visible row when the user hits the enter key and not expand the summary row?

Anthony Avella
Replied On March 1, 2005 02:39 AM UTC

What is the status of this?? >I''ve implemented the following code to allow the enter key to move the highlighted row down one row: > >public class DGridGroupingControl : GridGroupingControl > { > protected override bool ProcessCmdKey(ref Message msg, Keys keyData) > { > try > { > > if((keyData & Keys.KeyCode) == Keys.Tab ) > { > GridCurrentCell cc = this.TableControl.CurrentCell; > GridTableCellStyleInfo style = this.TableControl.Model[cc.RowIndex, cc.ColIndex]; > if(style != null && style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell) > { > Point p = this.TableControl.RangeInfoToRectangle(cc.RangeInfo).Location; > int x_offset = ((keyData & Keys.Shift) == 0) > ? this.TableControl.Model.ColWidths[cc.ColIndex] + 2 > : - 2;//this.TableControl.Model.ColWidths[cc.ColIndex - 1] + 2; > p.Offset(x_offset, 2); > if(x_offset < 0 && cc.ColIndex == this.TableControl.LeftColIndex) > this.TableControl.ScrollCellInView(cc.RowIndex, cc.ColIndex - 1); > Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(this.TableControl, p); > Console.WriteLine("ProcessCmdKey"); > return true; > } > } > else if((keyData & Keys.KeyCode) == Keys.Enter) > { > this.TableControl.CurrentCell.MoveDown(1); > } >I''m using this code for a grouped grid. > >The problem I have is when a user hits the enter key, the highlighted summary row is expanded and the next row under the expanded summary is shown and highlighted. The enter key will then move down each detail record with each hit of the key. > >I''d like the enter key to move the user down each visible row in the grid (in this case summary rows). > >How can I move down to the next visible row when the user hits the enter key and not expand the summary row? >

Administrator [Syncfusion]
Replied On March 1, 2005 05:50 PM UTC

Hi Anthony, I think it''s just a matter of returning true in your method. I create a sample. Let me know if you see the problem there. SummaryInCaptionWithEnterKey.zip Stefan

Anthony Avella
Replied On March 3, 2005 06:57 PM UTC

Your sample app. is giving me the following unhandled run time sql exception: An unhandled exception of type ''System.Data.SqlClient.SqlException'' occurred in system.data.dll Additional information: System error. @ line 131 of the app. When I add: return true; after: this.TableControl.CurrentCell.MoveDown(1); , as you told me to do, the problem became worse. I also added the OnGroupExpanding(GroupEventArgs e) function, but this made no difference. When I hit the enter key while in a custom caption row, nothing happened at all. Once I expanded the summary row, I was able to hit enter to move through the detail rows (which iseven less than before). Did I need to do more than this? What now? Thanks. >Hi Anthony, > >I think it''s just a matter of returning true in your method. > >I create a sample. Let me know if you see the problem there. > >SummaryInCaptionWithEnterKey.zip > >Stefan >

Administrator [Syncfusion]
Replied On March 3, 2005 07:57 PM UTC

Anthony, Sorry about that - it was because of a change in my code base I temporarily made. That''s why it worked for me. Try replacing the lines as follows: else if((keyData & Keys.KeyCode) == Keys.Enter) { msg.WParam = (IntPtr) Keys.Down; return base.ProcessCmdKey(ref msg, Keys.Down); } Then it should work. Don''t know why you are getting an SQL exception ... All data are loaded from an Xml file. Does it work if you set msdeAvailable = true? But try changing above lines in your code. If that works there is no need to worry why the sample gives an exception on your system. Stefan

Anthony Avella
Replied On March 8, 2005 01:26 PM UTC

There was no xml file in the zip file you sent me. >Anthony, > >Sorry about that - it was because of a change in my code base I temporarily made. That''s why it worked for me. > >Try replacing the lines as follows: > > else if((keyData & Keys.KeyCode) == Keys.Enter) > { > msg.WParam = (IntPtr) Keys.Down; > return base.ProcessCmdKey(ref msg, Keys.Down); > } > >Then it should work. > >Don''t know why you are getting an SQL exception ... All data are loaded from an Xml file. Does it work if you set msdeAvailable = true? But try changing above lines in your code. If that works there is no need to worry why the sample gives an exception on your system. > >Stefan >

Administrator [Syncfusion]
Replied On March 8, 2005 11:40 PM UTC

It''s the same xml file that is used with the SummaryInCaption example. I uploaded it here: Orders.zip Stefan

Anthony Avella
Replied On March 16, 2005 05:49 PM UTC

Sadly, the problem still exists. When I hit the enter key on the grid (in your sample app), the highlighted row only moves down for detail rows. I am unable to move the highlighted row from 1 summary row to another. Any more ideas? My users are expecting this. Thanks. >It''s the same xml file that is used with the SummaryInCaption example. > >I uploaded it here: Orders.zip > >Stefan

Administrator [Syncfusion]
Replied On March 17, 2005 01:06 AM UTC

Stefan, Anthony, I uploaded another version of the sample that works with 3.0.1.0 - that''s the version you have, correct? Click here: CS.zip I orginally used a later version when I worked on the sample. That''s why it worked for me. Sorry about the inconvinience, Stefan

Inamul
Replied On November 15, 2005 04:45 PM UTC

>Your sample app. is giving me the following unhandled run time sql exception: > >An unhandled exception of type ''System.Data.SqlClient.SqlException'' occurred in system.data.dll >Additional information: System error. > > @ line 131 of the app. > >When I add: >return true; >after: > this.TableControl.CurrentCell.MoveDown(1); >, as you told me to do, the problem became worse. > >I also added the OnGroupExpanding(GroupEventArgs e) function, but this made no difference. > >When I hit the enter key while in a custom caption row, nothing happened at all. > >Once I expanded the summary row, I was able to hit enter to move through the detail rows (which iseven less than before). > >Did I need to do more than this? > >What now? > >Thanks. > > > > >>Hi Anthony, >> >>I think it''s just a matter of returning true in your method. >> >>I create a sample. Let me know if you see the problem there. >> >>SummaryInCaptionWithEnterKey.zip >> >>Stefan >>

Administrator [Syncfusion]
Replied On November 15, 2005 06:49 PM UTC

Try hardcoding the line: string xmlDataFileName = @"Data\" + xmlFileName; to use the exact full pathname to where you have the orders.xml file located on your system.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;