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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Catching events in a dropdown combobox

Thread ID:

Created:

Updated:

Platform:

Replies:

31350 Jul 6,2005 07:21 AM UTC Jul 6,2005 02:14 PM UTC WinForms 8
loading
Tags: GridControl
Thabo
Asked On July 6, 2005 07:21 AM UTC

Hi, I''m using a GridGroupingControl Grid. In my grid, one of the columns has a a drop down combobox. when a row in a grid is deleted, is it possible to detect this in my comboBox as well. I know that to detect this in the grid i would use the RecordDeleted event handler. However i would also like my combobox to detect when a row in the parent grid is deleted. Regards David

Administrator [Syncfusion]
Replied On July 6, 2005 08:43 AM UTC

I am not sure I understand what you mean by wanting the combobox to know about a record being deleted. If you have derived a combobox cell type, then you can have the combobox listen to the RowDeleted event on the GridGroupingControl just like any other object can listen to public events on the GridGroupingControl. You probably would want your renderer class (which actually handles the dropdown) to some how know about the GridGroupingControl so it can subscribe to the GridGroupingControl event. You could do this by adding a public method, say WireEvents(GridGroupingControl grid), and then call this method after your GridGroupingControl and custom cell type have been initialzed.

Thabo
Replied On July 6, 2005 09:08 AM UTC

>I am not sure I understand what you mean by wanting the combobox to know about a record being deleted. > >If you have derived a combobox cell type, then you can have the combobox listen to the RowDeleted event on the GridGroupingControl just like any other object can listen to public events on the GridGroupingControl. You probably would want your renderer class (which actually handles the dropdown) to some how know about the GridGroupingControl so it can subscribe to the GridGroupingControl event. You could do this by adding a public method, say WireEvents(GridGroupingControl grid), and then call this method after your GridGroupingControl and custom cell type have been initialzed. Okay, i think i know how i''ll implement it. By the way, is there any event handler i can use apart from RecordDeleted/RecordDeleting. Is there maybe a RowDeleted event. I see that you''ve mentioned it above. Regards David

Administrator [Syncfusion]
Replied On July 6, 2005 09:47 AM UTC

The RowDeleted was a mistake. I meant to write RecordDeleted. You did not indicate what your datasource is, but it likely has events that are raised when something is deleted from it. For example, if it is an IBindingList datasource, then the IBindingListChanged event (with a specific e.ListChangedType value) is raised when an object is deleted from the list.

Thabo
Replied On July 6, 2005 12:40 PM UTC

>The RowDeleted was a mistake. I meant to write RecordDeleted. > >You did not indicate what your datasource is, but it likely has events that are raised when something is deleted from it. For example, if it is an IBindingList datasource, then the IBindingListChanged event (with a specific e.ListChangedType value) is raised when an object is deleted from the list. Okay, i must admit, i tried what you suggested about using the WireEvents method. However i still can''t get the combobox to listen to the event on the GGC. Here is my sample code: //GGC class code public class Form1 : System.Windows.Forms.Form{ private GridGroupingControl gridGroupingControl1; public Form1() { InitializeComponent(); InitializeProperties(); } private void InitializeProperties() { GridTableControl tableControl = TableControl; GridModel model = tableControl.Model.Model; GridTableModel tableModel = TableModel; GridCellModelCollection cellModelCollection = model.CellModels; // // Register Cell Models // string modelName = "PopUpCheckListBoxCellModel"; if (!cellModelCollection.ContainsKey(modelName)) { cellModelCollection.Add (modelName, new PopUpCheckListBoxCellModel (model)); } GridTableControlKeyEventHandler tcke = new GridTableControlKeyEventHandler(gridGroupingControl1_TableControlCurrentCellKeyDown); TableControlCurrentCellKeyDown -= tcke; TableControlCurrentCellKeyDown += tcke; . . } public void EsiDataSheet_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e) { //my code here } public WireEvents() { } } //ComboBox class public class PopUpCheckListBoxCellRenderer : GridDropDownCellRenderer { private CheckedListBox boxCheck = null; protected override void OnInitialize () { //i initialize my comboBox here } } My problem is making the ComboBox register with the TableControlCurrentCellKeyDown event in the GGC. What is suppose to go into the WireEvent method? Regards David

Administrator [Syncfusion]
Replied On July 6, 2005 01:47 PM UTC

Try this. Add these methods to your PopUpCheckListBoxCellRenderer class.
public void WireEvents(GridGroupingControl ggc)
{
  	ggc.TableControlCurrentCellKeyDown += new GridTableControlKeyEventHandler(ggc_TableControlCurrentCellKeyDown); 

}

public void ggc_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
	//your code here
}
In your form, have code like this. cellModelCollection.Add (modelName, new PopUpCheckListBoxCellModel (model)); //new code PopUpCheckListBoxCellRenderer cr = gridGroupingControl1.TableControl.CellRenderers[PopUpCheckListBoxCellModel] as PopUpCheckListBoxCellRenderer; cr.WireEvents(gridGroupingControl1);

Thabo
Replied On July 6, 2005 02:09 PM UTC

>Try this. > >Add these methods to your PopUpCheckListBoxCellRenderer class. >
>public void WireEvents(GridGroupingControl ggc)
>{
>  	ggc.TableControlCurrentCellKeyDown += new GridTableControlKeyEventHandler(ggc_TableControlCurrentCellKeyDown); 
>
>}
>
>public void ggc_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
>{
>	//your code here
>}
>
> >In your form, have code like this. > >cellModelCollection.Add (modelName, new PopUpCheckListBoxCellModel (model)); > >//new code >PopUpCheckListBoxCellRenderer cr = gridGroupingControl1.TableControl.CellRenderers[PopUpCheckListBoxCellModel] as PopUpCheckListBoxCellRenderer; >cr.WireEvents(gridGroupingControl1); > > The follwing line of code gives me an error: PopUpCheckListBoxCellRenderer cr = gridGroupingControl1.TableControl.CellRenderers[PopUpCheckListBoxCellModel] as PopUpCheckListBoxCellRenderer; Error is: [PopUpCheckListBoxCellModel] denotes a class where a variable was expected.. any ideas?

Thabo
Replied On July 6, 2005 02:13 PM UTC

> > >>Try this. >> >>Add these methods to your PopUpCheckListBoxCellRenderer class. >>
>>public void WireEvents(GridGroupingControl ggc)
>>{
>>  	ggc.TableControlCurrentCellKeyDown += new GridTableControlKeyEventHandler(ggc_TableControlCurrentCellKeyDown); 
>>
>>}
>>
>>public void ggc_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
>>{
>>	//your code here
>>}
>>
>> >>In your form, have code like this. >> >>cellModelCollection.Add (modelName, new PopUpCheckListBoxCellModel (model)); >> >>//new code >>PopUpCheckListBoxCellRenderer cr = gridGroupingControl1.TableControl.CellRenderers[PopUpCheckListBoxCellModel] as PopUpCheckListBoxCellRenderer; >>cr.WireEvents(gridGroupingControl1); >> >> >The follwing line of code gives me an error: > >PopUpCheckListBoxCellRenderer cr = gridGroupingControl1.TableControl.CellRenderers[PopUpCheckListBoxCellModel] as PopUpCheckListBoxCellRenderer; > >Error is: >[PopUpCheckListBoxCellModel] denotes a class where a variable was expected.. > >any ideas? Thanks i figured it out. I just had to add a string representing the name of the PopUpCheckListBoxCellModel.

Administrator [Syncfusion]
Replied On July 6, 2005 02:14 PM UTC

The argument of that call should be the string that holds the text that you used to register the cell model. If this was a standard combobox, the argument would be "ComboBox". What string did you use to register this cell model.

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

;