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.
Unfortunately, activation email could not send to your email. Please try again.

custom control & first click

Thread ID:

Created:

Updated:

Platform:

Replies:

27673 Apr 15,2005 10:20 AM May 17,2005 05:11 AM Windows Forms 5
loading
Tags: GridControl
Raul Rosenthal
Asked On April 15, 2005 10:20 AM

Hi. I have a custom control made of five checkboxes, that I use to edit a custom datatype of mine in a grid. I implemented it with the renderer machinery, as shown in the samples. It works fine, but the first click in the cell just activates the cell and does not go to the checkbox on which the user clicked. Subsequent clicks, after the cell has been activated, work as expected. I understand that when the cell is clicked, the editCtl is moved over the cell and initialized with the cell value. So when the cell is first clicked, there is no custom control to get the click. I tried to find a way to pass the click to the custom control after it has become active, but had no success. Can you help, please. Thanks, Raul

Administrator [Syncfusion]
Replied On April 15, 2005 10:32 AM

There is a helper method that tries to do a fake mouse click: Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(focusControl, p); where p is a Point in the coordinate system of the Control focusControl. So, when you control becomes active, you might try calling this method to see if it will handle this problem for you. If you have our source code, you can look at the renderer code for our GridGenericControlCellRenderer, \Syncfusion\Essential Suite\3.0.1.0\Windows\Grid.Windows\Src\Extensions\CellTypes\GridGenericControlCell.cs(379). It uses this method in an override on OnClick to refire the click.

Raul Rosenthal
Replied On April 18, 2005 05:38 AM

My renderer is derived from GridGenericControlCellRenderer, so I think the fake onclick should already get to my user control, but it does not. I copied the code of the onclick method to my renderer class, started the debugged and confirmed that it is executed as expected, but the OnClick event does not get to my custom control (I assume it should get a normal click event.) I ended up with a copy of the onclick code put in my renderer, modified to directly call a public method in my user control to handle the click. It works, but it''s awful. Have you any suggestion that could help me understand why my control does not received the click event? Thanks, Raul

Administrator [Syncfusion]
Replied On April 18, 2005 05:58 AM

Something you could try is to go ahead and set the focus to your control in the renderer.OnClick before calling the fakemouse click. maybe this will help in forwarding the click. The FakeLeftMouseClick is sort of a hack to begin with. It does not always work. If you look at its implementation code, Syncfusion\Essential Suite\3.0.1.0\Base\Shared.Base\Src\Drawing\ActiveXSnapshot.cs(297), you will see that it just sends window messages WM_LBUTTONDOWN and WM_LBUTTONUP through interop calls. In your setup, something must be catching these window messages before that hit your control, or the parameters are not set properly for the click you need. You could add an override of WndProc to your control class, and see if these messages are getting there, and if paramaters are what is expected. To see the expected parameters, you could try clicking the control after it is activated.

Naveed Ahmed Siddiqui
Replied On May 17, 2005 02:35 AM

I had similar problem with my custom control, which internally contains a checkbox and a combo box. Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(Control,Point), posts a MouseDown msg followed by MouseUp msg, but somehow these two msgs doesnot combine to give Mouse Click event to your control, that u can see by hooking Click event of your main control, that u will recieve MouseDown followed by MouseUp but no Click event. So even if u delegate your mouse event to one of your internal controls, that control wont get any mouse click. e.g. in your case; Checkbox''s checked state wont be toggled unless it gets Click event on it. hence delegating mouse event via Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(Control,Point) wont give u your desired functionality. I worked around this problem by toggling the checked state of my check box when mouse is clicked on it. But i couldnt do the same for my comboBox.

Administrator [Syncfusion]
Replied On May 17, 2005 05:11 AM

If you can upload a sample project showing the problem you are having, we may be able to suggest a specific solution.

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.

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.

;