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.

GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

2403 Jan 15,2003 08:23 AM Jan 16,2003 10:35 AM Windows Forms 4
loading
Tags: GridControl
Joe Nash
Asked On January 15, 2003 08:23 AM

How do I get the results of a GridListControl selection to be automatically accepted without the user having to hit enter or select another cell? Generally, I would prefer this behavior and in this specific case I am using the GridList Control in a dropdowngrid and I want to be able ensure that the last selection is accepted should the user close the dropdowngrid without hitting enter etc. Also, FYI it appears that OnCurrentCellCloseDropDown is not documented along with the other CurrentCell dropdown events.

Administrator [Syncfusion]
Replied On January 15, 2003 11:36 AM

Here is some code that you can add to the CellControlsGrid sample to get this behavior.
private void CellControlsForm_Load(object sender, System.EventArgs e)
{
	GridDropDownGridListControlCellRenderer cr = 
		(GridDropDownGridListControlCellRenderer) this.gridControl1.CellRenderers["GridListControl"];
	cr.ListControlPart.SelectedValueChanged += new EventHandler(SelectionChanged);
}

private void SelectionChanged(object sender, EventArgs e)
{
	GridDropDownGridListControlCellRenderer cr = 
		(GridDropDownGridListControlCellRenderer) this.gridControl1.CellRenderers["GridListControl"];
	int i = cr.ListControlPart.SelectedIndex;
	if(i > -1)
	{
		cr.EditPart.Text = cr.ListControlPart.Grid[i+1, 2].Text;
		this.gridControl1.CurrentCell.ConfirmChanges(false);
	}
}

Joseph Nash
Replied On January 15, 2003 08:22 PM

Thanks for the response but not much sucess with it. I tried the code changes you suggested in the sample (CellControlsGrid) and in my code with different but not correct actions in either case. The code as suggested wouldn't compile beacuse there are no overloads for ConfirmChanges that take any parameters, neither the documentation nor the tool tips shows any alternatives. So I removed the false parameter and it compiled. In the sample the popup drops but as soon as the mouse passes over it closes without an opportunity to click on anything. After insetring a write to the console Console.WriteLine(i.ToString()); if(i > -1) ... -1 is written when the popup drops and the index of the item passed over first is then displayed in output. (by entering the popup from the side I can pass over different items). In my code which is in a custom dropdowngrid, I couldn't hook it in form load so, I did that in OnCurrentCellShowedDropDown (OnCurrentCellShowingDropDown was too early) and later remove it in OnCurrentCellCloseDropDown. I get an event when the control drops and as each item is passed over but the selectedIndex is always -1. I also tried hooking cr.DropDownContainer.CloseUp the event fired but the selectedIndex again is -1. Any thoughts?

Administrator [Syncfusion]
Replied On January 16, 2003 05:22 AM

I am using version 1.5.1.4. In that version, ConfirmChanges has been overloaded to accept a bool parameter that indicates whether or not any dropdown should be closed. This parameter is exactly what is needed in your case to prevent the dropdown from closing prematurely. When the 1.5.1.4 version, the CellControls sample does compile and run and change the valsue displayed in the edit box as you move your mouse over the dropped list. You can get 1.5.1.4 as a private patch from your support home page on our web site. (Click on the Download Latest Service pack link). You might try this code with this 1.5.1.4 release. We will have a public patch available based on this source code in a week or so.

Joseph Nash
Replied On January 16, 2003 10:35 AM

Thnaks that did it. My code was looking at the cellrenderers for the top level grid, changing it to use the currentcell in the dropdowngrid fixed my problem.

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.

;