ValEdit, fix strange focus swapping reported by bart

git-svn-id: trunk@40358 -
This commit is contained in:
jesus 2013-02-20 09:28:58 +00:00
parent c8f3aa7628
commit d79e1a4d79

View File

@ -150,7 +150,7 @@ type
procedure DefineCellsProperty(Filer: TFiler); override; procedure DefineCellsProperty(Filer: TFiler); override;
function GetEditText(ACol, ARow: Integer): string; override; function GetEditText(ACol, ARow: Integer): string; override;
function GetCells(ACol, ARow: Integer): string; override; function GetCells(ACol, ARow: Integer): string; override;
procedure SelectEditor; override; function GetDefaultEditor(Column: Integer): TWinControl; override;
procedure SetCells(ACol, ARow: Integer; const AValue: string); override; procedure SetCells(ACol, ARow: Integer; const AValue: string); override;
procedure SetEditText(ACol, ARow: Longint; const Value: string); override; procedure SetEditText(ACol, ARow: Longint; const Value: string); override;
procedure TitlesChanged(Sender: TObject); procedure TitlesChanged(Sender: TObject);
@ -950,26 +950,28 @@ begin
end; end;
end; end;
procedure TValueListEditor.SelectEditor; function TValueListEditor.GetDefaultEditor(Column: Integer): TWinControl;
var var
ItemProp: TItemProp; ItemProp: TItemProp;
begin begin
inherited SelectEditor; Result:=inherited GetDefaultEditor(Column);
if Col <> 1 then Exit; // Only for the Value column if Column=1 then
begin
ItemProp := nil; ItemProp := nil;
//debugln('**** A Col=',dbgs(col),' Row=',dbgs(row),' (',dbgs(itemprop),')'); //debugln('**** A Col=',dbgs(col),' Row=',dbgs(row),' (',dbgs(itemprop),')');
ItemProp := Strings.GetItemProp(Row-FixedRows); ItemProp := Strings.GetItemProp(Row-FixedRows);
if Assigned(ItemProp) then if Assigned(ItemProp) then
case ItemProp.EditStyle of case ItemProp.EditStyle of
esSimple: Editor := EditorByStyle(cbsAuto); esSimple: result := EditorByStyle(cbsAuto);
esEllipsis: Editor := EditorByStyle(cbsEllipsis); esEllipsis: result := EditorByStyle(cbsEllipsis);
esPickList: begin esPickList: begin
Editor := EditorByStyle(cbsPickList); result := EditorByStyle(cbsPickList);
(Editor as TCustomComboBox).Items.Assign(ItemProp.PickList); (result as TCustomComboBox).Items.Assign(ItemProp.PickList);
//Style := csDropDown, default = csDropDownList; //Style := csDropDown, default = csDropDownList;
end; end;
end; end;
end; end;
end;
procedure TValueListEditor.SetCells(ACol, ARow: Integer; const AValue: string); procedure TValueListEditor.SetCells(ACol, ARow: Integer; const AValue: string);
var var