|
|
Home » Developing U++ » U++ Developers corner » Request for ChildKbdEvent()
Request for ChildKbdEvent() [message #8727] |
Wed, 28 March 2007 11:28  |
|
Is it possible to add virtual method similar to ChildMouseEvent but for a keyboard?
I need it for GridCtrl to make possible to change cell using keyboard even if child control has focus. For example devexpress xgrid works like this (I want to achieve the same effect):
you can change cursor position using keyboard arrows. Now - if cursor is moved to the cell with edit the full selection of text in this edit is made (gridctrl works in the same way here). If text is selected arrows keys can still change grid's cursor position. If any other key is pressed cell's edit take control of arrow keys.
It can be useful for other thing too and it would be a great completion for controling child mouse events.
|
|
|
|
Re: Request for ChildKbdEvent() [message #8731 is a reply to message #8728] |
Wed, 28 March 2007 14:57   |
|
luzr wrote on Wed, 28 March 2007 07:45 | I believe this is a little bit tricky.
Consider widget that reacts to "Down" key (e.g. LineEdit) and then pressing this "Down" key in the parent Ctrl. The result would be key "double action" (both cursor in LineEdit would move down AND GridCtrl cursor too).
|
Of coures one must know the type of the control and allow to change grid cursor position dependig on that. But as I said before when grid cell with embeded edit gets focus all the edit text is selected. In this state you allow arrows to change cursor position. There is no problem here with LineEdit. If you press cursor down you change cursor position. If any other key the selection is removed and LineEdit controls arrow keys. I can also imagine another way. If you press down arrow you allow LineEdit to change the line. But if you reach the last line and press down again - cursor changes its position. But to be able to implement that without creating your own widgets I need possibility to analyze child control keyboard events.
BTW: It would be great if Ctrl class have type field. For example GetType() could return Ctrl::EDIT, Ctrl::ARRAY_CTRL, CTRL::UNKNOWN and so on. It would be easier and cheaper to distinguish child control type than using RTTI. I know that there is rare need for using it, but in complicated controls like Grid or Array (or any other control that embed other controls and must take different actions based on child type) there is no other way sometimes.
|
|
|
|
Goto Forum:
Current Time: Mon Apr 28 18:04:30 CEST 2025
Total time taken to generate the page: 0.00697 seconds
|
|
|