Top/Bottom of Grid Keyboard Shortcuts in GridView?

12 posts, 1 answers
  1. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 24 Jul 2009 Link to this post

    .Net's DataGridView allows the Ctrl-Home / Ctrl-End keys to go to the top - left Cell / bottom - right Cell in the grid.  In RadGridView, those keys do the same as the Home / End keys which go to the first / last Cell of the Slected Row.  I couldn't find any combo of Home, End, Page Up, Page Down, Up, Down, Left or Right with the Shift, Ctrl or Alt modifiiers that would go to the top / bottom of the grid.  Are there top  / bottom of grid keys predefined?  Is there a way to override the standard navigation keys?

    Telerik Q1 2009 (v2009.1.9.414), VS 2005 (v8.0.50727.762 SP.050727-7600), XP SP3 on Core2Duo 2.99GHZ with 3GB.

  2. Answer
    Jack
    Admin
    Jack avatar
    2335 posts

    Posted 27 Jul 2009 Link to this post

    Hi Tom Chien,

    Currently these key combinations are not used in RadGridView. However, you can modify the grid behavior with a few lines of code. Just inherit from the BaseGridBehavior class and override its ProcessKey method. Here is a sample:

    this.radGridView1.GridBehavior = new MyGridBehavior(); 
     
     
    public class MyGridBehavior : BaseGridBehavior 
        public override bool ProcessKey(KeyEventArgs keys) 
        { 
            if (keys.Control && keys.KeyCode == Keys.Home) 
            { 
                this.GridControl.GridNavigator.SelectFirstRow(); 
                if (this.GridControl.CurrentRow is GridViewNewRowInfo) 
                { 
                    this.GridControl.GridNavigator.SelectNextRow(1, falsefalse); 
                } 
                this.GridControl.GridNavigator.SelectFirstColumn(); 
                return true
            } 
            if (keys.Control && keys.KeyCode == Keys.End) 
            { 
                this.GridControl.GridNavigator.SelectLastRow(); 
                this.GridControl.GridNavigator.SelectLastColumn(); 
                return true
            } 
            return base.ProcessKey(keys); 
        } 

    I hope this helps. We will include Ctrl+Home and Ctrl+End key combinations in one of our upcoming releases. I have updated your Telerik points for this suggestion. If you have any other ideas, we will be glad to hear them.

    Please don't hesitate to contact us if you have more questions.

    Kind regards,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 19 Oct 2009 Link to this post

    I just installed Telerik 2009Q3 Beta (2009.2.9.1016) over 2009Q2 (2009.2.9.729) and my Ctrl-Home and Ctrl-End Keys for Top and Bottom of Grid stopped working using the solution you had provided and the only RadGridView change mentioned was combined Vertical Scroll Bar for Grids with ChildTemplateView's.  It appears that instead of returning Windows.Forms.Keys.Home and Windows.Forms.Keys.End, it's simply returning Windows.Forms.Keys.ControlKey.

    Telerik 2009Q3 Beta (2009.2.9.1016), VS 2005 (v8.0.50727.762 SP.050727-7600), XP SP3 on Core2Duo 2.99GHZ with 3GB.
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 21 Oct 2009 Link to this post

    Hi Tom,

    ProcessKey arguments come from Control.ProcessDialogKey method and therefore the behavior can't be changed. However, there are still issues related to rows selection. We know about the problem and it will be addressed in the final release. Thank you for your feedback.

    Regards,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 22 Oct 2009 Link to this post

    Maybe I'm misunderstanding what you're trying to tell me, but what does the fact that you can't change the "behavior" of "Control.ProcessDialogKey" method have to do with the fact that the workaround you provided went from working to not working when I switched from Q2 2009 to Q3 2009 Beta?  Something changed to cause that when I upgraded my Telerik WinForms and I don't think it was the "Control.ProcessDialogKey" method of .Net 2's "Windows.System.Forms"

  7. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 23 Oct 2009 Link to this post

    Hi Tom,

    Yes, you are correct. There is an issue with SelectLastRow method in GridNavigator. I wanted to say, that the problem is not in ProcessDialogKey method which is obvious. And yes, we will address the issue in the final release. Thank you for writing me back.

    Sincerely yours,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 05 Nov 2009 Link to this post

    Thanks for adding Ctrl-Up / Ctrl-Down for top / bottom of RadGridView as standard features in Q3 2009.

    However:

    a) I would've preferred you add it as an "option" such that if the option were "on" (True or "off" / False - call it what and default it how you want), it would performed the standard behavior of top / bottom of RadGridView, otherwise it would do nothing except be passed to the KeyDown Event.  Just like in the movies, there should always be a "manual override". ;)

    b) In the Q2 2009  (2009.2.9.729), the work around you provided goes to the top / bottom of the current Master / Child GridViewTemplate.  In Q3 2009, both the workaround (if enabled) and the built-in behavior goes to the top / bottom of the whole MasterGridViewTemplate.  I think it  would be more useful to simply go to the top / bottom of the current Master / Child GridViewTemplate.  If the user wants to proceed further, he would still have the option to subsequently press Up / Down Arrow followed by Ctrl-Up / Ctrl-Down again, repeatedly until he gets to the top / bottom of whatever level of  Master / Child GridViewTemplate he wants.  With the other way, he has no choice.

    d) It looks in both cases (in item b), this is the result of Telerik changing the behavior of the SelectNextRow and SelectLastRow methods which is either an unintentional "bug" or an undocumented intentional "Breaking  change". 

    e) If it is a undocumented intentional "Breaking  change", I can sort of see an argument for, but I no longer have an easy way to manually implement the old behavior because RadGridView.CurrentRow.ViewInfo.CurrentIndex, since Q3 2009, is always returning 0 vs. the 0-based index of the CurrentRow relative to the Current Expanded GridViewTemplate (which I've reported in http://www.telerik.com/community/forums/winforms/gridview/expand-colllapse-master-parent-childgridviewtemplates-programmatically-in-radgridview.aspx).

    f) An additional option would be to implement Ctrl-Shift-Home / Ctrl-Shift-End keys as the top / bottom of the whole MasterGridViewTemplate so you can continue letting Ctrl-Up / Ctrl-Down be top / bottom of the current Master / Child GridViewTemplate.

    b and f obviously wouldn't apply in .Net's DataGridView that I based the original suggestion on because it doesn't have hierarchical sub-grids, but they are logical evolutions of the keys that were in DataGridView for a grid that does have hierarchical sub-grids.

    Telerik WinForms 2009Q3 (2009.3.9.1103), VB, VS 2005 (v8.0.50727.762 SP.050727-7600), .Net 2.0 (2.0.50727), XP SP3, 3GB, 2.99GHZ, Core2Duo.

  9. Vassil Petev
    Admin
    Vassil Petev avatar
    1765 posts

    Posted 06 Nov 2009 Link to this post

    Hi Tom,

    Thank you for your detailed feedback. We appreciate it.

    a) Yes, it is easy to have properties that enable/disable certain functionality in RadGridView. However, it can't be done for every piece of functionality. Otherwise, we will have 1000's of properties in RadGridView which is 1) developer nightmare (see the Infragistics forums to understand what I mean), and 2) not very intuitive. And yes, there is a "manual override". You should change the default GridBehavior by overriding BaseGridBehavior and processing the desired method (for example ProcessKeyDown, which is a well documented method).

    b) This is an interesting scenario. We will see whether more people need such change, and based of this feedback we will consider whether it is desirable to change the behavior of RadGridView this way.

    d) In Q3 2009 we changed the whole scrolling and navigation behavior of RadGridView and this is mentioned in our breaking changes list. The SelectNextRow, SelectLastRow methods are part of this behavior. That's way we didn't mentioned the change.

    e) You can find the answer to this question in your ticket.

    f) I think we both agree that this is not the best option.

    Thank you again for your feedback.
     

    Best wishes,
    Vassil
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 11 Nov 2009 Link to this post

    e) What "ticket"?

    f) Actually, I don't "agree".  Upon further review, I'll admit the Ctrl-Shift-Home / Ctrl-Shift-End Keys may not be the best keys to use, but only because the "Shift" Key Modifier is normally used in combination with navigation Keys to Mark multiple Items (hey, another "feature request"! ;)).  However, I still think the idea of implementing separate keys for top / bottom of Current and Master Grid is a good if not the best option.  Why would you not "agree" it's the "best" option?  If it's because it introduces to many / too complex Key combos, more complex u.i.'s require not only more but more complex Shortcut Keys and key combos.  For example, the Folders Tree in Windows Explorer could use simply the Home / End Keys for top / bottom of Tree.  However, in RadGridView, you had to use Ctrl-Home / Ctrl-End because Home / End Keys are needed to go to the first / last Columns which don't exist in the Folders Tree.  RadGridView supports nested hierarchical grids which DataGridView doesn't, so it's understandable that it's going to need more and more complex keys.  Look at any Word Processor and see all the navigation keys that go to different parts of a word, sentence, paragraph, page and / or document.
  11. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 13 Nov 2009 Link to this post

    Hi Tom Chien,

    Thank you for writing back. Regarding your questions:

    e) I referred to the forum post where you reported the issue - link.

    f) Yes, I agree that RadGridView is a complex control and needs more keyboard shortcuts. We have logged this in our TODO and we definitely will extend our keyboard support in future. I wanted to say that Ctrl-Shift-Home is not a widely known key combination, so we will research further to find the best option.
     

    Kind regards,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  12. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 18 Nov 2009 Link to this post

    e) Thanks.

    f) Re. "Ctrl-Shift-Home (/-End) is not a widely known key combination": As I as I admitted / suggested in my Nov. 11 post, It's probably not "widely known" to be used just for navigation.  However, as I speculated in that post also, it's often used for marking multiple items.  For example, it's used to mark from the cursor to the top (/ bottom) of the document in both MS Word and VS, the former app alone could qualify it as "widely known" and the latter app, you programmers at Telerik should already be familiar with.  What about my "feature request" to use these key combos for that purpose instead?  As for top / bottom of RadGridView, I suggest Ctrl-Alt-Home / Ctrl-Alt-End.  Note that for simple scenarios where there are no ChildGridViewTemplates, users can simply use Ctrl-Home / Ctrl-End since top / bottom of the CurrentRow's Grid would always be the same as top / bottom of the whole RadGridView.

  13. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 23 Nov 2009 Link to this post

    Hello Tom Chien,

    Regarding your question: As I said in my previous post, we need to research the best option. We will definitely add more shortcuts in RadGridView, including shortcuts for scrolling to the beginning and the end of a child view.

    Sincerely yours,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for WinForms is Visual Studio 2017 Ready