Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Request for ChildKbdEvent()
Request for ChildKbdEvent() [message #8727] Wed, 28 March 2007 11:28 Go to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

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 #8728 is a reply to message #8727] Wed, 28 March 2007 13:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
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).

Mirek
Re: Request for ChildKbdEvent() [message #8731 is a reply to message #8728] Wed, 28 March 2007 14:57 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

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.
Re: Request for ChildKbdEvent() [message #8733 is a reply to message #8731] Wed, 28 March 2007 16:15 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
unodgs wrote on Wed, 28 March 2007 08:57


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.



Note that current protocol is explicitly designed to deal with such issues well (true: key was used). In fact, you should rather ask about fixing LineEdit Smile

Quote:


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.



RTTI dynamic_cast is fast enought here to warrant such complex and limited facility.

Mirek
Previous Topic: Build method cleanup
Next Topic: Makefile generation ideas
Goto Forum:
  


Current Time: Mon Apr 29 02:50:08 CEST 2024

Total time taken to generate the page: 0.03366 seconds