Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
25998 | Mar 11,2005 09:48 AM UTC | Sep 7,2005 08:44 PM UTC | WinForms | 8 |
![]() |
Tags: GridControl |
CustomFilterBarCellModel model = this.gridGroupingControl1.TableModel.CellModels["CustFilterBarCell"] as CustomFilterBarCellModel;
model.SelectEmptyText = "SomeEmptyText";
Similarly, model.SelectAllText and model.SelectCustomText will let you control the text that appears for these options as well.
If you want to omit them entirely, then one way would be to add this override to teh custom cell model. Then if you set any of teh properties mentioned above to be teh empty string, then that empty option will not appear in teh drop list.
//these members used in renderer''s ListBoxMouseUp internal int offset = 0; internal int customOption = 1; internal int allOption = 0; public override void FillWithChoices(ListBox listBox, GridStyleInfo style, out bool exclusive) { base.FillWithChoices (listBox, style, out exclusive); this.offset = 0; this.customOption = 1; if(this.SelectAllText.Length == 0) { listBox.Items.RemoveAt(0); this.offset += 1; this.customOption -= 1; this.allOption = -1; } if(this.SelectCustomText.Length == 0) { this.customOption = -1; listBox.Items.RemoveAt(1 - offset); this.offset += 1; } if(this.SelectEmptyText.Length == 0) { listBox.Items.RemoveAt(2 - offset); this.offset += 1; } }If you remove any of the options, then things have to be adjusted in the renderer''s ListBoxMouseUp override using the values saved in the cellmodel.
protected override void ListBoxMouseUp(object sender, MouseEventArgs e) { GridTableCellStyleInfo tableStyleInfo = (GridTableCellStyleInfo) StyleInfo; GridTableCellStyleInfoIdentity tableCellIdentity = tableStyleInfo.TableCellIdentity; if( this.ListBoxPart.SelectedIndex == filterModel.customOption) { MyFilterBarCustomDlg dlg = new MyFilterBarCustomDlg(); dlg.colLabel.Text = tableCellIdentity.Column.MappingName; dlg.SetStrings(filterModel.FilterBarStrings); if(dlg.ShowDialog() == DialogResult.OK) { //apply the filter tableCellIdentity.Table.TableDescriptor.RecordFilters.Add(dlg.FilterString); } } else { if( this.ListBoxPart.SelectedIndex == filterModel.allOption) tableCellIdentity.Table.TableDescriptor.RecordFilters.Clear(); int index = this.ListBoxPart.SelectedIndex; if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset) index += filterModel.offset; CurrentCell.CloseDropDown(PopupCloseType.Done); Model.Select(tableCellIdentity, index); SetTextBoxText(GetFilterBarText(StyleInfo), false); } }
>CustomFilterBarCellModel model = this.gridGroupingControl1.TableModel.CellModels["CustFilterBarCell"] as CustomFilterBarCellModel;
>model.SelectEmptyText = "SomeEmptyText";
>
>
>Similarly, model.SelectAllText and model.SelectCustomText will let you control the text that appears for these options as well.
>
>If you want to omit them entirely, then one way would be to add this override to teh custom cell model. Then if you set any of teh properties mentioned above to be teh empty string, then that empty option will not appear in teh drop list.
>>//these members used in renderer''s ListBoxMouseUp >internal int offset = 0; >internal int customOption = 1; >internal int allOption = 0; >public override void FillWithChoices(ListBox listBox, GridStyleInfo style, out bool exclusive) >{ > base.FillWithChoices (listBox, style, out exclusive); > this.offset = 0; > this.customOption = 1; > if(this.SelectAllText.Length == 0) > { > listBox.Items.RemoveAt(0); > this.offset += 1; > this.customOption -= 1; > this.allOption = -1; > } > if(this.SelectCustomText.Length == 0) > { > this.customOption = -1; > listBox.Items.RemoveAt(1 - offset); > this.offset += 1; > } > if(this.SelectEmptyText.Length == 0) > { > listBox.Items.RemoveAt(2 - offset); > this.offset += 1; > } >} >>If you remove any of the options, then things have to be adjusted in the renderer''s ListBoxMouseUp override using the values saved in the cellmodel. > >
>protected override void ListBoxMouseUp(object sender, MouseEventArgs e) >{ > GridTableCellStyleInfo tableStyleInfo = (GridTableCellStyleInfo) StyleInfo; > GridTableCellStyleInfoIdentity tableCellIdentity = tableStyleInfo.TableCellIdentity; > if( this.ListBoxPart.SelectedIndex == filterModel.customOption) > { > MyFilterBarCustomDlg dlg = new MyFilterBarCustomDlg(); > dlg.colLabel.Text = tableCellIdentity.Column.MappingName; > dlg.SetStrings(filterModel.FilterBarStrings); > if(dlg.ShowDialog() == DialogResult.OK) > { > //apply the filter > tableCellIdentity.Table.TableDescriptor.RecordFilters.Add(dlg.FilterString); > } > } > else > { > if( this.ListBoxPart.SelectedIndex == filterModel.allOption) > tableCellIdentity.Table.TableDescriptor.RecordFilters.Clear(); > > int index = this.ListBoxPart.SelectedIndex; > if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset) > index += filterModel.offset; > CurrentCell.CloseDropDown(PopupCloseType.Done); > Model.Select(tableCellIdentity, index); > SetTextBoxText(GetFilterBarText(StyleInfo), false); > } >} >
if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset)
to
if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex >= filterModel.offset)
>if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset)
>
>to
>
>if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex >= filterModel.offset)
>
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.
This page will automatically be redirected to the sign-in page in 10 seconds.