VK_RETURN handling in Tree class

Post Reply
User avatar
Luis Krause
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

VK_RETURN handling in Tree class

Post by Luis Krause »

Antonio:

Any idea why the Enter key isn't trapped inside oTree:bKeyDown?

Code: Select all

oTree:bKeyDown := {|nKey,nFlags| ;
   if( nKey == VK_RETURN, msginfo("never happens"), ;
   if( nKey == VK_SPACE, msginfo("space bar"), nil ) ) }
I can handle VK_INSERT, VK_DELETE and others, but VK_RETURN never
gets passed down to ::bKeyDown by the TTreeView class.

I just noticed that TTreeView:HandleEvent() has code pertaining VK_RETURN. I commented it out, but it makes no difference.... the Enter key doesn't get processed :-(


Thanks!
"May the Source be with GNU"
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Luis,

Do you have a default pushbutton on the same dialog ? If so, VK_RETURN will be routed to it.

I have modified samples\TestTree.prg with

oTree:bKeyDown := {|nKey,nFlags| ;
if( nKey == VK_RETURN, msginfo("never happens"), ;
if( nKey == VK_SPACE, msginfo("space bar"), nil ) ) }

and it works fine for VK_RETURN
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Luis Krause
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Post by Luis Krause »

Antonio:
Antonio Linares wrote: Do you have a default pushbutton on the same dialog ? If so, VK_RETURN will be routed to it.
It seems I have a little mystery in my hands. You're right, it works just fine in testtree.prg. In my case the tree is on a modal dialog with a toolbar, but no standard buttons, so there are no default pushbuttons.

For some reason, when the tree is on a dialog, the Enter key is not processed!

Any idea what could be "eating" the Enter key?

Regards,

Luis
"May the Source be with GNU"
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Luis,

You may need to set oTree:nDlgCode := DLGC_WANTALLKEYS
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Luis Krause
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Post by Luis Krause »

Antonio:
Antonio Linares wrote:You may need to set oTree:nDlgCode := DLGC_WANTALLKEYS
Thanks a million - that did the trick!

Regards,

Luis
"May the Source be with GNU"
Post Reply