PDA

View Full Version : Property Grid and tab key



Chris Spencer
20-Feb-2010, 03:26 AM
What is needed to allow the TAB key to tab through a property grid as the behaviour the Studio
does??

I have tried on_key Key_Tab send default_Key (the usual way with COM) however it doesn't work

Any ideas?

Vincent Oorsprong
20-Feb-2010, 04:52 AM
Chris,

I think you have to respond to the OnComKeyDown event.

Chris Spencer
20-Feb-2010, 05:06 PM
Vincent,
I think there may more to it than that.
I do not even get that event firing.

Vincent Oorsprong
21-Feb-2010, 01:15 AM
Chris,

I spend 5 minutes with the debugger and found out that;

You have to code the "On_Key Key_Tab Send Default_Key" in the object of the cCJPropertyGrid class.
OnComKeyDown and OnComKeyUp are then operating

But, more important is another property called NavigateItems. By default set to false, but read the docs and you will see you want it set to true.

Chris Spencer
21-Feb-2010, 04:17 PM
Vincent
Sorry to labour on this.

Did you actually get the tabbing to work??
If you did what action if any does the onComKeyDown need to perform (you mentioned this in both posts)?

No matter what I do the tab key straight away moves me to the NEXT object on the form. There is no rotation through the items.

In fact has anyone else done this and got it to work??

CJ is powerful but one of the worst documented controls I have used to achieve what should be simple tasks
Had a similar fight with the docking panels to get them to remember the last location across sessions. Jus finding stuff is a real chore

Vincent Oorsprong
22-Feb-2010, 12:56 AM
Chris,

I got it working.

I did not need OnComKeyDown. I mentioned that when you use the On_Key Key_Tab Send Default_Key you will see that on tab key you see the OnComKeyDown fireing.

What you need is setting the NavigateItems property. So:



On_Key Key_Tab Send Default_Key

Procedure OnCreate
Set ComNavigateItems To True
// Other
End_Procedure


CodeJock has reasonable documentation. It is not super but it is much better than many other COM modules I have worked with. But as you know, documentation is the last thing done in a creative project and by then either the time to make proper documentation, the drive to create it or/and any other combination is missing. In this case I think the documentation is OK. See what is written:

The NavigateItems property is used to specify how the items in the grid are navigated when pressing the Tab key.

Chris Spencer
22-Feb-2010, 02:28 AM
Vincent
Done exactly what you have shown.
however a question is there any othere control on the dialog?
I have a grid also and as soon as I tab the focus goes to the grid

Maybe thats the killer

PS
I wouldn't even be trying to get tab to work (mouse is fine as far as I an concerned)
However this is a clients request and as they say they are always right <G>

Vincent Oorsprong
22-Feb-2010, 02:45 AM
Chris,

The dialog that I used can be found as ImageProperties.Dg in the Dialogs folder of the ImageGallery example application (Graphics Library). The dialog also has a form, a checkbox and a button. The propertygrid has a help area enabled.

PS: The current code in the 2.1 example does not have the tab key functionality but I've used this dialog to test with.

Chris Spencer
22-Feb-2010, 05:11 AM
Vincent

Ok Found the problem
There was another control on the dialog that was a Com object also (not a CJ one).
When this was removed tabbing behaved as I wanted
When that control is replaced tabbing tabs straight from the propertygrid to that control.

Would you have any reason why this might behave like that???