Ultragrid - ctrl-TAB won't work out of UG in groupbox when on TabPage


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
This is both interesting and frustrating ( like so many things in our profession Wink )



In the example the only change i have made to Ivan's clever trick of placing the UG in a groupbox which handles the TabOrderController is to put that groupbox on a TabPage ( and are all the ultragrids in my app )



ctrl-Tab seems reserved to move between tab pages. But ctrl-E is also a problem. Not sure where the focus goes, since in watch window it shows e.keycode is not keys.E but CntrlKey {17} ( this is also true when it is Cntrl-TAB )



Oddly, Ctrl-A, Ctrl-X etc work as expected. And my code in the OnKeydown to have cntrl-Delete delete the row works fine, so I am not sure how the keycode is getting intercepted by the TabControl..



Notice in the sample that if the TabControl is removed, the groupbox/ultragrid work exactly as in the original example.



I have not been able to figure out if this is a SF thing or just a .NET tabcontrol thing or where to intervene.



If it is not fixable I need to convert my app to use panels or something instead but before I go that direction I'd like to know this can't be fixed and that I am not going to have the same problem there.



Thanks in advance ( Ivan BigGrin )
Attachments
UtragridSample2.zip (206 views, 191.00 KB)
Replies
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
Well, no joy so far. ProcessCmdKey gets the same results. I also have not been able to get to work using a panel manager instead of TabControl.



I think I need to subclass the TabControl and let the ctrl-TAB pass through to the grid as some of the other Ctrl combinations do ( my cntl-Delete I created works fine - Ctrl-E does not ) I thought it might be in the SF TabControl but there is no code in the SF controls handling keystrokes.



I have tried overriding ProcessCmdKey at the tabcontrol level to just return and not call the baseclass if the key combo is ctrl-tab but that doesn't work



The processcmdkey on the baseform still sees the the TAB as controlkey if it is combined with control ( just as the onkeydown does )



I'm really stuck and the interface pretty much depends on this working ( have a question up on Stackoverflow but no answers yet ) w00t



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
Yeah, I have been playing with it a lot too, but it is quite difficult to control this situation.

Anyway, I got a bit near... since you've got Infragistics, I used the UltraTabControl instead, and the reason was that I could set a mneumonic to its tab names, like Tab&1, Tab&2, which will show Tab1, Tab2. I also set the TabStop for the control as False. This way, you could tell your users that they need to Alt+1, Alt+2 and so on, using the mneumoics you assigned to the Tabs, to get them focused, and then the Tab key would allow them to navigate inside the controls you drop in each page, your UltraGrid for instance. To get out of them, they Alt+X the page again and use the ****+Tab to go to the previous control, and then Tab through the other controls outside the UltraTabControl as they wish...

What about that? w00t

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
Hey, the **** should be  S h i f t ... but I might have spelt it wrongly. BigGrin
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
Not sure I understand. Moving between tab pages isn't the problem. I just need to subclass the tab control to completely ignore key input just as the form does, no? I will look at the ultratab to see if I can turn it off there.



Somewhere a tabcontrol is handling control tab and I think all I need to do is convince it to ignore it.



I'll read your reply over a couple of times to see if I'm getting it but I may end up just finding a combination that is *not* blocked by tabcontrol and using that. So far I know ctrl-tab and ctrl-E won't work.



Maybe Stackoverflow will come to the rescue ...



It just seems it should be easier than this, given the granular control we have over most of the .net events.



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
BigGrinBigGrinBigGrinBigGrinBigGrinBigGrinBigGrin



Actually, it is kind of easy. ( or at least the 90% I have so far is )



First, the ctrl-tab handled by the tabcontrol has to be disabled. In the subclass of TabControl :



Public Class MyTabControl

Inherits MicroFour.StrataFrame.UI.Windows.Forms.TabControl



Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)

If e.KeyCode = Keys.Tab AndAlso e.Control Then

e.Handled = False

e.SuppressKeyPress = False

Else

MyBase.OnKeyDown(e)

End If



End Sub

End Class




This allows the cntrl-tab to fire in the Ultragrid and to actually leave the grid and the groupbox. The problem is, I can't tell where it goes next. the next control doesn't get focus, but tab again and the control after that gets focus, so it did honor the tab order but somehow lost energy for focusing.



But if I explicitly call the focus() of that next control in the tab order in groupbox.leave everything is good.



Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter

Me.grdCustomers.Focus()

End Sub



Private Sub GroupBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles GroupBox1.Leave

Me.Textbox2.Focus()

End Sub





For now, this will work, though I want to make it generic and actually have a subclassed groupbox that knows how to set focus to its contained ultragrid on Enter and set focus to the next control according to the TabOrderController on Leave.



I'll be working on it more but here is it so far





Attachments
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
Brilliant, Charles! Great to hear you got it working. Wink
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
                         Yeah, I have been playing with it a lot too, but it is quite difficult...
Ivan George Borges - 15 Years Ago
                             Hey, the **** should be S h i f t ... but I might have spelt it...
Ivan George Borges - 15 Years Ago
                                 Not sure I understand. Moving between tab pages isn't the problem. I...
Charles R Hankey - 15 Years Ago
                                     :D:D:D:D:D:D:D

Actually, it [b]is[/b] kind of easy. ( or at...
Charles R Hankey - 15 Years Ago
                                         Brilliant, Charles! Great to hear you got it working. ;)
Ivan George Borges - 15 Years Ago
Charles R Hankey - 15 Years Ago
Greg McGuffey - 15 Years Ago
Edhy Rijo - 15 Years Ago
Ivan George Borges - 15 Years Ago
                         I only have one data field in my grid which defaults to now() so I...
Charles R Hankey - 15 Years Ago
                             Yep, guess we have this ahead of us. :ermm: The SF wrapper...
Ivan George Borges - 15 Years Ago
                                 I have not been able to figure out where to intervene to translate the...
Charles R Hankey - 15 Years Ago
                                     I was dealing with other things around here, back to the matter. I...
Ivan George Borges - 15 Years Ago
                                 I seems the question we really need to ask is : How do we display the...
Charles R Hankey - 15 Years Ago
                                     Hi Charles. I think I found a way to handle this, not sure you will...
Ivan George Borges - 15 Years Ago
                                         Ah, forgot to say... set the actual date column Hidden property to...
Ivan George Borges - 15 Years Ago
                                             YOU ARE MY HERO ! :D

I will test this tonight and let you...
Charles R Hankey - 15 Years Ago
                                                 While I'm testing your solution, here's the response I got on...
Charles R Hankey - 15 Years Ago
                                                     [b][quote]Você é um gênio e você é meu herói[/quote][/b]
Charles R Hankey - 15 Years Ago
                                                         Works beautifully ! ( though I was less successful in putting...
Charles R Hankey - 15 Years Ago
                                                         [quote][b]Charles R Hankey (06/09/2010)[/b][hr][b][quote]Você é um...
Ivan George Borges - 15 Years Ago
                                                     [quote][b]Charles R Hankey (06/09/2010)[/b][hr]While I'm testing your...
Ivan George Borges - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search