select index of item in list, if text occurs in list

git-svn-id: trunk@6780 -
This commit is contained in:
micha 2005-02-11 16:26:26 +00:00
parent ac8ba31fd1
commit aa256339b2
2 changed files with 26 additions and 0 deletions

View File

@ -693,6 +693,25 @@ begin
Result:=FItemIndex;
end;
{------------------------------------------------------------------------------
Method: TCustomComboBox.RealSetText
Params: AValue -
Returns: nothing
If the text AValue occurs in the list of strings, then sets the itemindex,
otherwise does the default action
------------------------------------------------------------------------------}
procedure TCustomComboBox.RealSetText(const AValue: TCaption);
var
I: integer;
begin
I := FItems.IndexOf(AValue);
if I >= 0 then
ItemIndex := I
else
inherited;
end;
{------------------------------------------------------------------------------
Method: TCustomComboBox.SetItemIndex
Params: Val -
@ -778,6 +797,9 @@ end;
{
$Log$
Revision 1.54 2005/02/11 16:26:26 micha
select index of item in list, if text occurs in list
Revision 1.53 2005/02/06 20:43:57 micha
remember text of combobox in case one sets itemindex (fixes bug 536)

View File

@ -281,6 +281,7 @@ type
procedure SetSelText(const Val: string); virtual;
procedure SetSorted(Val: boolean); virtual;
procedure SetStyle(Val: TComboBoxStyle); virtual;
procedure RealSetText(const AValue: TCaption); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
@ -1217,6 +1218,9 @@ end.
{ =============================================================================
$Log$
Revision 1.192 2005/02/11 16:26:26 micha
select index of item in list, if text occurs in list
Revision 1.191 2005/02/04 15:36:50 mattias
published TComboBox.ItemIndex from Sergios