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,25 +950,27 @@ 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
ItemProp := nil; begin
//debugln('**** A Col=',dbgs(col),' Row=',dbgs(row),' (',dbgs(itemprop),')'); ItemProp := nil;
ItemProp := Strings.GetItemProp(Row-FixedRows); //debugln('**** A Col=',dbgs(col),' Row=',dbgs(row),' (',dbgs(itemprop),')');
if Assigned(ItemProp) then ItemProp := Strings.GetItemProp(Row-FixedRows);
case ItemProp.EditStyle of if Assigned(ItemProp) then
esSimple: Editor := EditorByStyle(cbsAuto); case ItemProp.EditStyle of
esEllipsis: Editor := EditorByStyle(cbsEllipsis); esSimple: result := EditorByStyle(cbsAuto);
esPickList: begin esEllipsis: result := EditorByStyle(cbsEllipsis);
Editor := EditorByStyle(cbsPickList); esPickList: begin
(Editor as TCustomComboBox).Items.Assign(ItemProp.PickList); result := EditorByStyle(cbsPickList);
//Style := csDropDown, default = csDropDownList; (result as TCustomComboBox).Items.Assign(ItemProp.PickList);
//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);