From b9bd15f7c61057c59a12f1683be7b9acd4744c5e Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 13 Mar 2006 00:29:50 +0000 Subject: [PATCH] implemented cbactRetainPrefixCase for TComboBox git-svn-id: trunk@8929 - --- lcl/include/customcombobox.inc | 17 +++++++++++++---- lcl/stdctrls.pp | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lcl/include/customcombobox.inc b/lcl/include/customcombobox.inc index efc7a8047b..3475be31a1 100644 --- a/lcl/include/customcombobox.inc +++ b/lcl/include/customcombobox.inc @@ -432,25 +432,33 @@ end; procedure TCustomComboBox.KeyUp(var Key: Word; Shift: TShiftState); var iSelStart: Integer; - sCompleteText: string; + sCompleteText, sPrefixText, sResultText: string; begin inherited KeyUp(Key, Shift); if ((cbactEnabled in FAutoCompleteText) and (Style <> csDropDownList)) then begin //Only happens with alpha-numeric keys and return key and csDropDown Style - if not (IsEditableTextKey(Key) or (Key = VK_RETURN)) then Exit; + if not (IsEditableTextKey(Key) or (Key = VK_RETURN) or (ssShift in Shift)) then Exit; if (Key = VK_RETURN) then SelectAll else begin iSelStart := SelStart;//Capture original cursor position //End of line completion if ((iSelStart < Length(Text)) and (cbactEndOfLineComplete in FAutoCompleteText)) then Exit; + sPrefixText := LeftStr(Text, iSelStart); sCompleteText := GetCompleteText(Text, iSelStart, (cbactSearchCaseSensitive in FAutoCompleteText), (cbactSearchAscending in FAutoCompleteText), Items); if not (sCompleteText = Text) then begin - Text := sCompleteText; + sResultText := sCompleteText; + if ((cbactEndOfLineComplete in FAutoCompleteText) and + (cbactRetainPrefixCase in FAutoCompleteText)) then + begin//Retain Prefix Character cases + Delete(sResultText, 1, iSelStart); + Insert(sPrefixText, sResultText, 1); + end;//End if ((cbactEndOfLineComplete in FAutoCompleteText) and.... + Text := sResultText; SelStart := iSelStart; SelLength := Length(Text); end;//End if not (sCompleteText = Text) @@ -460,10 +468,11 @@ end; procedure TCustomComboBox.MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer); +var R: TRect; begin inherited MouseUp(Button, Shift, X, Y); //if (Style = csDropDownList) then - // DroppedDown := not DroppedDown; + // DroppedDown := not DroppedDown; end; {------------------------------------------------------------------------------ diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 2a0d80d904..c5507a3cc4 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -214,6 +214,7 @@ type TComboBoxAutoCompleteTextOption = ( cbactEnabled,//Enable Auto-Completion Feature cbactEndOfLineComplete,//Perform Auto-Complete only when cursor is at end of line + cbactRetainPrefixCase,//Retains the case of characters user has typed if is cbactEndOfLineComplete cbactSearchCaseSensitive,//Search Text with CaseSensitivity cbactSearchAscending//Search Text from top of the list );