function TEsoftExComboBox.CreateColumns: TDBGridColumns; begin Result := TDBGridColumns.Create(FDataGrid, TColumn); end;
destructor TEsoftExComboBox.Destory; begin FDataGrid.Free; FTmpfrm.Free; end;
procedure TEsoftExComboBox.DropDown; var ScreenPoint : TPoint; begin inherited; ScreenPoint := Parent.ClientToScreen( Point( self.Left, self.Top+self.Height )); with FTmpfrm do begin Left := ScreenPoint.X; Top := ScreenPoint.Y; Width := FDataGridWidth; Height := FDataGridHeight; FDataGrid.Columns.Assign(FDataColumns); end; FTmpfrm.Show; end;
procedure TEsoftExComboBox.SelectData(Sender: TObject); begin Text := FDataGrid.DataSource.DataSet.FieldValues[FSelectField]; FTmpfrm.Hide; end;
procedure TEsoftExComboBox.SetColumns(const Value: TDBGridColumns); begin FDataColumns := Value; end;
procedure TEsoftExComboBox.SetDataGridHeight(const Value: integer); begin if FDataGridHeight <> Value then begin FDataGridHeight := Value; FDataGrid.Height := Value; end; end;
procedure TEsoftExComboBox.SetDataGridWidth(const Value: integer); begin if FDataGridWidth <> value then begin FDataGridWidth := Value; FDataGrid.Width := Value; end; end;
procedure TEsoftExComboBox.SetDataSource(const Value: TDataSource); begin if FDataSource <> Value then begin FDataSource := Value; FDataGrid.DataSource := Value; end; end;
procedure TEsoftExComboBox.SetSelectField(const Value: String); begin FSelectField := Value; end;
{ TSelectFieldEditer }
{function TSelectFieldEditer.GetAttributes: TPropertyAttributes; begin Result := [paValueList, paSortList, paRevertable]; end; }
{procedure TSelectFieldEditer.GetValues(Proc: TGetStrProc); var i : integer; SelectData : TEsoftExComboBox; begin inherited; SelectData := GetComponent(0) as TEsoftExComboBox; if SelectData.Columns.Count <>0 then for i :=0 to SelectData.Columns.Count-1 do Proc(SelectData.Columns.Items[i].FieldName); end; }