marser
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору procedure TForm1.LookupComboBoxOnChange(Sender: TObject); var AEdit: TcxCustomLookupComboBox; begin AEdit := TcxCustomLookupComboBox(Sender); if AEdit.ModifiedAfterEnter then begin with AEdit.ActiveProperties.Grid do begin DataController.Filter.BeginUpdate; try DataController.Filter.Root.Clear; if (AEdit.EditingText <> '') and (AEdit.PopupWindow.Visible or (Tag = 1)) then begin DataController.Filter.Root.AddItem(Columns[0], foLike, '%' + AEdit.EditingText + '%', AEdit.EditingText); DataController.Filter.Active := True; end else DataController.Filter.Active := False; finally DataController.Filter.EndUpdate; end; Tag := 0; FocusedRowIndex := TopRowIndex; SyncSelected(True); end; end; end; procedure TForm1.LookupComboBoxOnCloseUp(Sender: TObject); begin TcxCustomLookupComboBox(Sender).ActiveProperties.Grid.DataController.Filter.Clear; end; procedure TForm1.LookupComboBoxOnInitPopup(Sender: TObject); var AEdit: TcxCustomLookupComboBox; begin AEdit := TcxCustomLookupComboBox(Sender); AEdit.ActiveProperties.Grid.Tag := 1; with AEdit.ActiveProperties.Grid.DataController.Filter do begin Options := Options + [fcoCaseInsensitive]; Clear; end; end; procedure TForm1.LookupComboBoxOnValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var AEdit: TcxLookupComboBox; begin AEdit := TcxLookupComboBox(Sender); if VarToStr(DisplayValue) = '' then AEdit.EditValue := Null; if not VarIsType(AEdit.EditValue, [varEmpty, varNull]) then DisplayValue := VarToStr(AEdit.Properties.ListSource.DataSet.Lookup(AKeyFieldName, AEdit.EditValue, AEdit.Properties.ListFieldNames)); end; | Всего записей: 398 | Зарегистр. 29-03-2007 | Отправлено: 09:10 18-03-2011 | Исправлено: marser, 09:10 18-03-2011 |
|