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 

Cell Editor only on Cell Click not Double Click

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



Joined: 23 Jun 2006
Posts: 3

PostPosted: Fri Jun 23, 2006 2:12 pm    Post subject: Cell Editor only on Cell Click not Double Click Reply with quote

Hi,

I am using Programmatic binding and a Cell Editor. I would like to only use the Cell Editor if the user Clicks the cell, and handle the Double Click myself with a different action. I cannot figure out how to do this. Can you pls give advice on the best way to go about this.

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



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sat Jun 24, 2006 12:45 am    Post subject: Reply with quote

The CellEditor is actually activated by default in the MouseDown event. This is because the Click event is not fired until the user releases the mouse button. The MouseDown event however will be received when the user clicks or double clicks - meaning it will be difficult to distinguish the conditions. There are a couple of options if you want to change this.

The first option is to set VirtualTree.SelectBeforeEdit to true. This requires that the user first selects a row before editing cells in it. This would allow you to trap double clicks/and or clicks without interaction with the CellEditor.

The second option is to change the behaviour by creating a custom CellWidget class and overriding the OnMouseDown and OnClick methods. See the Custom Widget sample project for an example of how to do this. The following is a little bit of a hack but it will work:

Code:
        MouseEventArgs mouseDownArgs;

        public override void OnMouseDown(MouseEventArgs e)
        {
            mouseDownArgs = e;
            RowWidget.OnMouseDown(e);
        }

        public override void OnClick(EventArgs e)
        {
            base.OnMouseDown (mouseDownArgs);
        }


This basically stops the cell mouse down from activating the edit and changes OnClick to do what OnMouseDown used to.

Rather than calling base.OnMouseDown from OnClick it would be cleaner simply to call Tree.EditWidget = this; However the EditWidget property is protected and can't be accessed directly from the derived CellWidget class. You could add an internal property to the derived VirtualTree class to allow access to this property and then call that.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
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