Ultrawingrid - handling keypress and setting focus to row on enter


Author
Message
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K


Two Ultrawingrid issues :



What is the best way to cause the focus to go to the first column of the first row when the grid is entered via tabbing from the previous control. i.e. so you can immediately start typing or tabbing through the gird.



How does one handle the keypress so that a ctrl-Tab will exit the grid and move to the next control in the TOController tab order.?



Thanks



( if you know the answer and could email it to me I'd appreciate it as i may need it before the forum goes down for maintenance)



Reply
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Charles.

SetFocustonextControl(true) is an UltraGrid method, so it will work fine inside an inherited UltraGrid. But then, you want to use Ctrl+Tab to exit the UltraGrid, which I agree is the easier thing for the user to understand, but I wasn't able to catch the keydown Ctrl+Tab from inside the UltraGrid.

In order to do that, I used my BaseForm and added the following code:

    Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, _
                                               ByVal keyData As System.Windows.Forms.Keys) As Boolean
        '-- check for unique keystrokes
        Select Case keyData
            Case Keys.Control Or Keys.Tab
                '-- created to be able to tab out of a Grid control
                Me.SelectNextControl(Me.ActiveControl, True, True, True, True)
        End Select

        Return MyBase.ProcessCmdKey(msg, keyData)
    End Function

This worked fine for me, since all forms will tab to next control once the user types Ctrl+Tab.

Regarding the Subs, they are overriding the grid's OnKeyDown (which we don't need anymore since we are testing the ProcessCmdKey in our base form) and OnEnter subs. That is why we call the MyBase.OnEnter(e) (remember DODEFAULT()? Smile)

Thanks for the question, I wanted to write these features for myself as well. BigGrin

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Charles R Hankey - 15 Years Ago
Ivan George Borges - 15 Years Ago
Charles R Hankey - 15 Years Ago
Charles R Hankey - 15 Years Ago
Charles R Hankey - 15 Years Ago
Ivan George Borges - 15 Years Ago
Ivan George Borges - 15 Years Ago
Charles R Hankey - 15 Years Ago
Ivan George Borges - 15 Years Ago
Ivan George Borges - 15 Years Ago
                     Clever idea. I'll have a look at it tonight.

Obrigado...
Charles R Hankey - 15 Years Ago
                         Ivan, thank you so much for the groupbox trick to get the...
Charles R Hankey - 15 Years Ago
                             Glad it helped, Charles! ;)
Ivan George Borges - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search