We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

custom cell - keypress Issue

Thread ID:

Created:

Updated:

Platform:

Replies:

8961 Nov 30,2003 01:14 PM UTC Dec 4,2003 09:17 AM UTC WinForms 4
loading
Tags: GridControl
vamsi krishna
Asked On November 30, 2003 01:14 PM UTC

Hi, I created a custom cell by derived CellModel and CellRenderer classes and placed in the grid. Issue 1: On keypress on that cell of grid is not activating the contol but the same happens on mouse click. Issue 2: On Arrow keypress in that custom control moves the focus to next cell rather than traversing in that custom control. Please suggest me solution for the above issues. Thanks in advance. Regards, Vamsi Krishna.

Administrator [Syncfusion]
Replied On November 30, 2003 02:30 PM UTC

1) In your derived cell control, override OnKeyDown and activate the cell control by calling CurrentCell.BeginEdit there (while you handle the initial keystroke). If you have the source code, you can look at the GridTextBoxCellRenderer.OnKeyDown to see how that cell control handles activating the control when the first key is pressed. 2) You need to override ProcessKeyEventArgs in the cell renderer class. In your override, if you want the embedded control to handle the key message, then you need to call the ProcessKeyEventArgs method on the embedded control. To do this since the ProcessKeyEventArgs method is protected, you need to derive the control class you are using and expose a public method that calls its ProcessKeyEventArgs method. If you look at the GridInCells sample, it uses the ProcessKeyEventArgs override to allow the embedded grid to handle the arrow keys instead of letting the parent grid handle them.

vamsi krishna
Replied On December 3, 2003 12:07 AM UTC

Hi Clay Burch, Thank you very for the solution. I am able to resolve both the issues. I have one more issue. My custom control is a UserContorl which works like a date picker. It has maskeditbox,button,popupcontrol container and a month calender. On click of button will open a month calender. Now the issue is on mouse click in the region where my button is there in the cell i want the popup to come but on the first click in that cell the focus goes to control and after another click my popup comes. So it making me to double click to choose the date. Is it possible to trap the mouse click position say if it is in the last 20 pixels position then call the control button click event rather than focusing the control. Please suggest me solution to resolve this issue. Thanks in advance. Regards, Vamsi.

Administrator [Syncfusion]
Replied On December 3, 2003 07:21 AM UTC

Try overriding your renderer''s OnClick method. In the override, check where the mouse position is, and if it is close to your button, then show your popup. To do this, you probably will have to expose the PopupContainer and Button so the renderer can access them in some manner (maybe make them public or add public methods to handle it).
Protected Overrides Sub OnClick(ByVal rowIndex As Integer, ByVal colIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs)
        MyBase.OnClick(rowIndex, colIndex, e)
        Dim userCtl As CALDatePicker = Me.Control
        Dim pt As Point = userCtl.PointToClient(Control.MousePosition)
        Dim rect As Rectangle = userCtl.btnImage.Bounds
        rect = New Rectangle(rect.Left - 20, rect.Y, rect.Width + 20, rect.Height)
        If rect.Contains(pt) Then
            userCtl.PopupControlContainer1.Focus()
            userCtl.PopupControlContainer1.ShowPopup(Point.Empty)
        End If
    End Sub

vamsi krishna
Replied On December 4, 2003 09:17 AM UTC

Thank you very much. Now my issue is resolved.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;