Ticket Q228966
Visible to All Users

How to toggle a checkbox editor with a single click when EditorShowModue = MouseUp

created 13 years ago
Comments (2)
DevExpress Support Team 13 years ago

    Hello,
    In order to have the entire content of a cell selected when clicking in a grid, the gridView.OptionsBehavior property must be set to MouseUp, as it is described in A277 KB article - http://devexpress.com/Support/Center/KB/p/A277.aspx.
    However, this creates some problems when having CheckEdit repositories because the user has to click twice to toggle the check edit (one click activates the editor and the second click toggles the repository's value).
    To overcome this, I have successfully implemented the solution described in the following KB: http://www.devexpress.com/Support/Center/p/Q143431.aspx
    But this KB only covers the case in which the CheckEdit repository is set via ColumnEdit property.
    How to implement this for a TreeList control?
    Thank you very much!
    Sorin.

    DevExpress Support Team 13 years ago

      Hi Sorin,
      In the case of the TreeList you can utilize the same approach as with the GridControl.

      C#
      private void treeList1_MouseDown(object sender, MouseEventArgs e) { if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { TreeList list = sender as TreeList; TreeListHitInfo hi = list.CalcHitInfo(e.Location); if (hi.HitInfoType == HitInfoType.Cell) { list.FocusedNode = hi.Node; list.FocusedColumn = hi.Column; list.ShowEditor(); CheckEdit edit = (list.ActiveEditor as CheckEdit); if (edit != null) edit.Toggle(); } } }

      I have created a sample that demonstrates this approach.
      Thanks,
      Gosha

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.