VK_RETURN handling in Tree class

VK_RETURN handling in Tree class

Postby Luis Krause » Fri Nov 10, 2006 1:07 am

Antonio:

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

Code: Select all  Expand view
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
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Postby Antonio Linares » Fri Nov 10, 2006 7:18 am

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
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Luis Krause » Fri Nov 10, 2006 9:44 pm

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
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Postby Antonio Linares » Fri Nov 10, 2006 10:41 pm

Luis,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Luis Krause » Sat Nov 11, 2006 1:28 am

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"
User avatar
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests