Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

EditOnKeyPress & OnKeyUp

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
GreyCloud



Joined: 13 Nov 2008
Posts: 19

PostPosted: Sun Jul 18, 2010 8:13 pm    Post subject: EditOnKeyPress & OnKeyUp Reply with quote

Hi,

when i have EditOnKeyPress true and also handle the OnKeyUp method i find the onKeyUp gets called twice - is this correct behaviour? Question

David
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Jul 19, 2010 12:56 am    Post subject: Reply with quote

I wasn't able to replicate this behaviour using the DataSet Browser sample project. If you can replicate this behaviour in a small sample project and send us zipped copy to support@infralution.com (with step by step description of what you are doing) then we will take a closer look at the issue.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
GreyCloud



Joined: 13 Nov 2008
Posts: 19

PostPosted: Mon Jul 19, 2010 4:36 pm    Post subject: Reply with quote

meh, coding late at night is unhealthy, i should have mentioned the "key" issue being the key combination - Shift+Enter Embarassed sorry! Wink

I have mailed through an example with steps to reproduce

David
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Jul 20, 2010 12:36 am    Post subject: Reply with quote

Thanks for the sample. There is a minor issue in the way Virtual Tree is handling "Enter" key presses when EditOnKeyPress is set to true. In this case Virtual Tree is sending opening the first editor and then sending it the "Enter" key press - which in turn causes the editor to close.

The workaround is to handle the KeyPress event and if the character is an enter mark the event as handled - this will prevent VirtualTree from further handling the event and prevent the behaviour. eg

Code:
private void _virtualTree_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == 13)
    {
        e.Handled = true;
    }
}


We will fix this in the next release.

Quote:
Out of interest is there any way to disable the default key commands (enter to edit, arrow keys and tab to navigate when the modifier keys are down? – for example I wanted to use ctrl-up/down to move siblings up and down and also shift and ctrl enter to do add child / sibling)


To handle the enter, escape and arrow keys you need to override the ProcessCmdKey method or the sub-methods that it calls

Code:
ProcessNormalCmdKeys // called when there is no active editor
    ProcessEscapeCmdKey
    ProcessEnterCmdKey
    ProcessRightCmdKey etc

ProcessEditCmdKeys      // called when there is an active editor
    ProcessEditEscapeCmdKey
    ProcessEditEnterCmdKey
    ProcessEditRightCmdKey etc

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
GreyCloud



Joined: 13 Nov 2008
Posts: 19

PostPosted: Tue Jul 20, 2010 9:13 am    Post subject: Reply with quote

As ever, excellent support Very Happy

Thanks

David
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group