mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 22:39:21 +02:00
lcl: TCustomEdit: property AutoSelect, CustomComboBox: property AutoSelect and property CharCase from Funky Beast
git-svn-id: trunk@10327 -
This commit is contained in:
parent
ffb717dbc2
commit
503a5be753
@ -1027,10 +1027,48 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TGroupBox.OnUnDock">
|
||||
<short/>
|
||||
<descr/>
|
||||
<descr>
|
||||
<short>property AutoCompleteText: TComboBoxAutoCompleteText</short>
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- enumeration type Visibility: default -->
|
||||
<element name="TComboBoxAutoCompleteTextOption">
|
||||
<short>TComboBoxAutoCompleteTextOption defines the behavior of the AutoComplete feature in a combobox control.</short>
|
||||
<descr>TComboBoxAutoCompleteTextOption = (cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase,
|
||||
cbactSearchCaseSensitive, cbactSearchAscending);
|
||||
|
||||
Defines the behavior of the AutoComplete feature.
|
||||
<ul><li>cbactEnabled: Enable Auto-Completion feature.</li><li>cbactEndOfLineComplete: Perform Auto-Complete only when cursor is at the end of the string.</li><li>cbactRetainPrefixCase: Retains the case of characters user has typed. (This option has no effect if cbactEndOfLineComplete is False)</li><li>cbactSearchCaseSensitive: Search completion string with case sensitivity.</li><li>cbactSearchAscending: Search completion string in accending order. (False will search in descending order)</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TComboBoxAutoCompleteTextOption.cbactEnabled">
|
||||
<short/>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TComboBoxAutoCompleteTextOption.cbactEndOfLineComplete">
|
||||
<short/>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TComboBoxAutoCompleteTextOption.cbactRetainPrefixCase">
|
||||
<short/>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TComboBoxAutoCompleteTextOption.cbactSearchCaseSensitive">
|
||||
<short/>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TComboBoxAutoCompleteTextOption.cbactSearchAscending">
|
||||
<short/>
|
||||
</element>
|
||||
<!-- set type Visibility: default -->
|
||||
<element name="TComboBoxAutoCompleteText">
|
||||
<short>TComboBoxAutoCompleteText = set of TComboBoxAutoCompleteTextOption;</short>
|
||||
<descr/>
|
||||
<seealso><link id="TComboBoxAutoCompleteTextOption"/></seealso>
|
||||
</element>
|
||||
<!-- enumeration type Visibility: default -->
|
||||
<element name="TComboBoxStyle">
|
||||
<short>ComboBox Style</short>
|
||||
<descr>ComboBox Style: may be Simple, a Drop-Down or a drop-down list, or some version drawn by the Owner</descr>
|
||||
@ -1107,6 +1145,43 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<descr>Custom Combination Box: the base class from which Combo Box is derived.</descr>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomComboBox.FCharCase">
|
||||
<short>FCharCase: TEditCharCase</short>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomComboBox.FAutoCompleteText">
|
||||
<short>FAutoCompleteText: TComboBoxAutoCompleteText</short>
|
||||
<descr>Private variable of property AutoCompleteText.
|
||||
|
||||
Options for behavior of the Auto-Complete feature.
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomComboBox.FAutoSelect">
|
||||
<short>FAutoSelect: Boolean</short>
|
||||
<descr>Private variable for property AutoSelect.
|
||||
|
||||
When True, the edit control will select all its text when:
|
||||
<ul><li>It recieves focus</li><li>The Enter key is pressed.</li><li>A new item is selected.</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomComboBox.FAutoSelected">
|
||||
<short>FAutoSelected: Boolean</short>
|
||||
<descr>Private variable for property AutoSelected.
|
||||
|
||||
True indicate that the edit or combobox control has just performed
|
||||
an AutoSelect opertation so that subsequent mouse-clicks and keystrokes
|
||||
proceeds normally without selecting the text.
|
||||
|
||||
False is set when the edit or combobox control looses focus.
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomComboBox.FAutoDropDown">
|
||||
<short/>
|
||||
<descr/>
|
||||
@ -1187,7 +1262,11 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomComboBox.FOnMeasureItem">
|
||||
<short/>
|
||||
<descr/>
|
||||
<descr>
|
||||
<short>Combo Box</short>
|
||||
<descr>Combo box. A simple combination of text box for free text entry, and a drop-down list allowing one of several options to be chosen.
|
||||
</descr>
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
@ -1782,6 +1861,12 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<errors/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<element name="TCustomComboBox.CharCase">
|
||||
<short>property CharCase: TEditCharCase</short>
|
||||
<descr>Indicates how text is displayed in a text editing control in the following ways:
|
||||
<ul><li>Normal case letters</li><li>Upper case letters</li><li>Lower case letters</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomComboBox.DroppedDown">
|
||||
<short/>
|
||||
@ -1811,12 +1896,43 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomComboBox.AutoComplete">
|
||||
<short/>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomComboBox.AutoCompleteText">
|
||||
<short>property AutoCompleteText: TComboBoxAutoCompleteText</short>
|
||||
<descr>Options for behavior of the Auto-Complete feature.
|
||||
</descr>
|
||||
<seealso><link id="TComboBoxAutoCompleteTextOption"/></seealso>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomComboBox.AutoDropDown">
|
||||
<short/>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomComboBox.AutoSelect">
|
||||
<short>property AutoSelect: Boolean</short>
|
||||
<descr>When True, the edit control will select all its text when:
|
||||
<ul><li>It recieves focus</li><li>The Enter key is pressed.</li><li>A new item is selected.</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomComboBox.AutoSelected">
|
||||
<short>property AutoSelected: Boolean</short>
|
||||
<descr>True indicate that the edit or combobox control has just performed
|
||||
an AutoSelect operation so that subsequent mouse-clicks and keystrokes
|
||||
proceeds normally without selecting the text.
|
||||
|
||||
False is set when the edit or combobox control looses focus.
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomComboBox.ArrowKeysTraverseList">
|
||||
<short/>
|
||||
<descr/>
|
||||
@ -1906,18 +2022,48 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.AutoComplete">
|
||||
<short>property AutoComplete: Boolean</short>
|
||||
<descr>True: Turns on auto-complete feature.
|
||||
False: Turns off auto-complete feature.</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.AutoCompleteText">
|
||||
<short>property AutoCompleteText: TComboBoxAutoCompleteText</short>
|
||||
<descr>Options for behavior of the Auto-Complete feature.
|
||||
</descr>
|
||||
<seealso><link id="TComboBoxAutoCompleteTextOption"/>
|
||||
<link id="TComboBoxAutoCompleteText"/>
|
||||
</seealso>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.AutoDropDown">
|
||||
<short/>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.AutoSelect">
|
||||
<short>property AutoSelected: Boolean</short>
|
||||
<descr>When True, the edit control will select all its text when:
|
||||
<ul><li>It recieves focus</li><li>The Enter key is pressed.</li><li>A new item is selected.</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.BorderSpacing">
|
||||
<short/>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.CharCase">
|
||||
<short>property CharCase: TEditCharCase</short>
|
||||
<descr>Indicates how text is displayed in a text editing control in the following ways:
|
||||
<ul><li>Normal case letters</li><li>Upper case letters</li><li>Lower case letters</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.Ctl3D">
|
||||
<short/>
|
||||
<descr/>
|
||||
@ -2095,7 +2241,11 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<element name="TComboBox.Style">
|
||||
<short/>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
<seealso>
|
||||
<descr>Options for behavior of the Auto-Complete feature.
|
||||
</descr>
|
||||
<seealso><link id="TComboBoxAutoCompleteTextOption"/><link id="TComboBoxAutoCompleteText"/></seealso>
|
||||
</seealso>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TComboBox.TabOrder">
|
||||
@ -3259,25 +3409,25 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
</element>
|
||||
<!-- enumeration type Visibility: default -->
|
||||
<element name="TEditCharCase">
|
||||
<short/>
|
||||
<short>Determines the case of text displayed in the edit box or combobox.</short>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TEditCharCase.ecNormal">
|
||||
<short/>
|
||||
<short>Character case according to what the user types.</short>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TEditCharCase.ecUppercase">
|
||||
<short/>
|
||||
<short>Converts every character that the user types into upper case characters.</short>
|
||||
</element>
|
||||
<!-- enumeration value Visibility: default -->
|
||||
<element name="TEditCharCase.ecLowerCase">
|
||||
<short/>
|
||||
<short>Converts every character that the user types into lower case characters.</short>
|
||||
</element>
|
||||
<!-- enumeration type Visibility: default -->
|
||||
<element name="TEchoMode">
|
||||
<short/>
|
||||
<short>TEchoMode: Determines how strings in the edit box is displayed.</short>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
@ -3298,11 +3448,34 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<short>Custom Edit</short>
|
||||
<descr>Custom Edit: the base type from which Edit Box is derived.</descr>
|
||||
</element>
|
||||
<element name="TCustomEdit.FAutoSelect">
|
||||
<short>FAutoSelect: Boolean</short>
|
||||
<descr>Private variable for property AutoSelect.
|
||||
|
||||
When True, the edit control will select all its text when:
|
||||
<ul><li>It recieves focus</li><li>The Enter key is pressed.</li><li>A new item is selected.</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomEdit.FAutoSelected">
|
||||
<short>FAutoSelected: Boolean</short>
|
||||
<descr>Private variable for property AutoSelected.
|
||||
|
||||
True indicate that the edit or combobox control has just performed
|
||||
an AutoSelect opertation so that subsequent mouse-clicks and keystrokes
|
||||
proceeds normally without selecting the text.
|
||||
|
||||
False is set when the edit or combobox control looses focus.</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomEdit.FCharCase">
|
||||
<short/>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
<short>FCharCase: TEditCharCase</short>
|
||||
<descr>Private variable for property CharCase.
|
||||
|
||||
Indicates how text is displayed in a text editing control in the following ways:
|
||||
<ul><li>Normal case letters</li><li>Upper case letters</li><li>Lower case letters</li></ul></descr>
|
||||
<seealso><link id="TEditCharCase"/><link id="TEditCharCase.ecNormal"/><link id="TEditCharCase.ecUppercase"/><link id="TEditCharCase.ecLowerCase"/></seealso>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomEdit.FEchoMode">
|
||||
@ -3583,6 +3756,25 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<element name="TCustomEdit.KeyUp.Shift">
|
||||
<short/>
|
||||
</element>
|
||||
<!-- property Visibility: protected -->
|
||||
<element name="TCustomEdit.AutoSelect">
|
||||
<short>property AutoSelect: Boolean</short>
|
||||
<descr>When True, the edit control will select all its text when it
|
||||
recieves focus or when the Enter key is pressed.
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: protected -->
|
||||
<element name="TCustomEdit.AutoSelected">
|
||||
<short>property AutoSelected: Boolean</short>
|
||||
<descr>True indicate that the edit or combobox control has just performed
|
||||
an AutoSelect operation so that subsequent mouse-clicks and keystrokes
|
||||
proceeds normally without selecting the text.
|
||||
|
||||
False is set when the edit or combobox control looses focus.
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- constructor Visibility: public -->
|
||||
<element name="TCustomEdit.Create">
|
||||
<short/>
|
||||
@ -3631,8 +3823,9 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TCustomEdit.CharCase">
|
||||
<short/>
|
||||
<descr/>
|
||||
<short>property CharCase: TEditCharCase</short>
|
||||
<descr>Indicates how text is displayed in a text editing control in the following ways:
|
||||
<ul><li>Normal case letters</li><li>Upper case letters</li><li>Lower case letters</li></ul></descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
@ -3984,6 +4177,12 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<descr>Edit Box: for entry or display of a single line of text.
|
||||
<br/>Inherits most of its properties from TCustomEdit</descr>
|
||||
</element>
|
||||
<!-- property Visibility: public -->
|
||||
<element name="TEdit.AutoSelected">
|
||||
<short>property AutoSelected: Boolean</short>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TEdit.Action">
|
||||
<short>Action</short>
|
||||
@ -4006,6 +4205,12 @@ radio buttons will be mutually exclusive within the group.</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TEdit.AutoSelect">
|
||||
<short>property AutoSelect: Boolean</short>
|
||||
<descr/>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- property Visibility: published -->
|
||||
<element name="TEdit.BorderSpacing">
|
||||
<short/>
|
||||
<descr/>
|
||||
@ -5686,8 +5891,15 @@ User-defined Procedure</descr>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
<element name="TCustomStaticText.FAlignment">
|
||||
<short/>
|
||||
<descr/>
|
||||
<short>FAutoSelected: Boolean</short>
|
||||
<descr>Private variable for property AutoSelected.
|
||||
|
||||
True indicate that the edit or combobox control has just performed
|
||||
an AutoSelect operation so that subsequent mouse-clicks and keystrokes
|
||||
proceeds normally without selecting the text.
|
||||
|
||||
False is set when the edit or combobox control looses focus.
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
<!-- variable Visibility: private -->
|
||||
|
@ -101,6 +101,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.DoEnter;
|
||||
begin
|
||||
inherited DoEnter;
|
||||
//AutoSelect when DoEnter is fired by keyboard
|
||||
if (Style = csDropDownList) then Exit;//Non editable style
|
||||
if (FAutoSelect and not (csLButtonDown in ControlState)) then
|
||||
begin
|
||||
SelectAll;
|
||||
if (SelText = Text) then FAutoSelected := True;
|
||||
end;//End if (((Style = csDropDown) or.........
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.DoExit;
|
||||
begin
|
||||
FAutoSelected := False;
|
||||
inherited DoExit;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomComboBox.SetSorted
|
||||
Params: val - true means "sort" the combo
|
||||
@ -204,6 +222,11 @@ begin
|
||||
if not ReadOnly then
|
||||
EditingDone;
|
||||
if Assigned(FOnCloseUp) then FOnCloseUp(Self);
|
||||
if FAutoSelect then
|
||||
begin
|
||||
SelectAll;
|
||||
if (SelText = Text) then FAutoSelected := True;
|
||||
end;//End if FAutoSelect
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -376,6 +399,18 @@ begin
|
||||
inherited WMChar(Message);
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.SetCharCase(eccCharCase: TEditCharCase);
|
||||
begin
|
||||
if (FCharCase <> eccCharCase) then
|
||||
begin
|
||||
FCharCase := eccCharCase;
|
||||
case FCharCase of
|
||||
ecUpperCase: Text := UpperCase(Text);
|
||||
ecLowerCase: Text := Lowercase(Text);
|
||||
end;//End case
|
||||
end;//End if (FCharCase <> eccCharCase)
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
skip : Boolean;
|
||||
@ -427,39 +462,69 @@ 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) or (ssShift in Shift)) then Exit;
|
||||
if (Key = VK_RETURN) then
|
||||
SelectAll else
|
||||
//Only happens with alpha-numeric keys and return key and editable Style
|
||||
if (IsEditableTextKey(Key) or (Key = VK_RETURN) or (ssShift in Shift)) then
|
||||
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
|
||||
if (Key = VK_RETURN) then
|
||||
SelectAll else
|
||||
begin
|
||||
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)
|
||||
end;//End if (Key = VK_RETURN)
|
||||
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
|
||||
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)
|
||||
end;//End if (Key = VK_RETURN)
|
||||
end;//End if (IsEditableTextKey(Key) or (Key = VK_RETURN) or (ssShift in Shift))
|
||||
end;//End if ((cbactEnabled in FAutoCompleteText) and (Style = csDropDown))
|
||||
//SelectAll when hitting return key for AutoSelect feature
|
||||
if (Key = VK_RETURN) then
|
||||
begin
|
||||
if FAutoSelect then
|
||||
begin
|
||||
SelectAll;
|
||||
if (SelText = Text) then FAutoSelected := True;
|
||||
end;//End if FAutoSelect
|
||||
end;//End if (Key = VK_RETURN)
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.KeyPress(var Key: char);
|
||||
begin
|
||||
//Convert character cases if FCharCase is not ecNormalCase
|
||||
case FCharCase of
|
||||
ecLowerCase: Key := lowerCase(Key);
|
||||
ecUpperCase: Key := upCase(Key);
|
||||
end;//End case
|
||||
inherited KeyPress(Key);
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.MouseUp(Button: TMouseButton; Shift:TShiftState;
|
||||
X, Y: Integer);
|
||||
begin
|
||||
inherited MouseUp(Button, Shift, X, Y);
|
||||
inherited MouseUp(Button, Shift, X, Y);
|
||||
//AutoSelect when left mouse is clicked for the 1st time after having focus
|
||||
if (Button = mbLeft) then
|
||||
begin
|
||||
if (FAutoSelect and not FAutoSelected) then
|
||||
begin
|
||||
SelectAll;
|
||||
if (SelText = Text) then FAutoSelected := True;
|
||||
end;//End if (FAutoSelect and not FAutoSelected)
|
||||
end;//End if (Button = mbLeft)
|
||||
//if (Style = csDropDownList) then
|
||||
// DroppedDown := not DroppedDown;
|
||||
end;
|
||||
@ -627,6 +692,9 @@ begin
|
||||
TabStop := true;
|
||||
ParentColor := false;
|
||||
FAutoCompleteText := [cbactEndOfLineComplete, cbactSearchAscending];
|
||||
FAutoSelect := False;
|
||||
FAutoSelected := False;
|
||||
FCharCase := ecNormal;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -55,6 +55,8 @@ begin
|
||||
SetInitialBounds(0,0,80,23);
|
||||
FEchoMode := emNormal;
|
||||
BorderStyle := bsSingle;
|
||||
FAutoSelect := False;
|
||||
FAutoSelected := False;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -348,7 +350,15 @@ end;
|
||||
procedure TCustomEdit.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
if Key=VK_RETURN then EditingDone;
|
||||
if Key=VK_RETURN then
|
||||
begin
|
||||
EditingDone;
|
||||
if FAutoSelect then
|
||||
begin
|
||||
SelectAll;
|
||||
if (SelText = Text) then FAutoSelected := True;
|
||||
end;//End if FAutoSelect
|
||||
end;//End if Key=VK_RETURN
|
||||
end;
|
||||
|
||||
procedure TCustomEdit.WMChar(var Message: TLMChar);
|
||||
@ -363,6 +373,20 @@ begin
|
||||
inherited WMChar(Message);
|
||||
end;
|
||||
|
||||
procedure TCustomEdit.MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer);
|
||||
begin
|
||||
inherited MouseUp(Button, Shift, X, Y);
|
||||
//AutoSelect when left mouse is clicked for the 1st time after having focus
|
||||
if (Button = mbLeft) then
|
||||
begin
|
||||
if (FAutoSelect and not FAutoSelected) then
|
||||
begin
|
||||
SelectAll;
|
||||
if (SelText = Text) then FAutoSelected := True;
|
||||
end;//End if (FAutoSelect and not FAutoSelected)
|
||||
end;//End if (Button = mbLeft)
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomEdit.SetModified
|
||||
Params: Value to set FModified to
|
||||
@ -396,6 +420,23 @@ Begin
|
||||
if Assigned(FOnChange) then FOnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomEdit.DoEnter;
|
||||
begin
|
||||
//AutoSelect when DoEnter is fired by keyboard
|
||||
if (FAutoSelect and not (csLButtonDown in ControlState)) then
|
||||
begin
|
||||
SelectAll;
|
||||
if (SelText = Text) then FAutoSelected := True;
|
||||
end;//End if FAutoSelect
|
||||
inherited DoEnter;
|
||||
end;
|
||||
|
||||
procedure TCustomEdit.DoExit;
|
||||
begin
|
||||
FAutoSelected := False;
|
||||
inherited DoExit;
|
||||
end;
|
||||
|
||||
procedure TCustomEdit.InitializeWnd;
|
||||
var
|
||||
ASelStart, ASelLength : integer;
|
||||
|
@ -36,6 +36,11 @@ uses
|
||||
|
||||
type
|
||||
|
||||
{ TCustomEdit Options}
|
||||
|
||||
TEditCharCase = (ecNormal, ecUppercase, ecLowerCase);
|
||||
TEchoMode = (emNormal, emNone, emPassword);
|
||||
|
||||
{ TScrollBar }
|
||||
|
||||
TScrollStyle = (ssNone, ssHorizontal, ssVertical, ssBoth,
|
||||
@ -238,7 +243,10 @@ type
|
||||
|
||||
TCustomComboBox = class(TWinControl)
|
||||
private
|
||||
FCharCase: TEditCharCase;
|
||||
FAutoCompleteText: TComboBoxAutoCompleteText;
|
||||
FAutoSelect: Boolean;
|
||||
FAutoSelected: Boolean;
|
||||
FAutoDropDown: Boolean;
|
||||
FCanvas: TCanvas;
|
||||
FDropDownCount: Integer;
|
||||
@ -275,9 +283,12 @@ type
|
||||
procedure UpdateSorted;
|
||||
procedure SetArrowKeysTraverseList(Value: Boolean);
|
||||
procedure WMChar(var Message: TLMChar); message LM_CHAR;
|
||||
procedure SetCharCase(eccCharCase: TEditCharCase);
|
||||
protected
|
||||
procedure InitializeWnd; override;
|
||||
procedure DestroyWnd; override;
|
||||
procedure DoEnter; override;
|
||||
procedure DoExit; override;
|
||||
procedure DrawItem(Index: Integer; ARect: TRect;
|
||||
State: TOwnerDrawState); virtual;
|
||||
procedure LMChanged(var Msg); message LM_CHANGED;
|
||||
@ -308,6 +319,7 @@ type
|
||||
procedure RealSetText(const AValue: TCaption); override;
|
||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
procedure KeyPress(var Key: char); override;
|
||||
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer); override;
|
||||
function SelectItem(const AnItem: String): Boolean;
|
||||
|
||||
@ -333,6 +345,7 @@ type
|
||||
MaxHistoryCount: integer; SetAsText, CaseSensitive: boolean);
|
||||
procedure Clear; virtual;
|
||||
procedure ClearSelection; //override;
|
||||
property CharCase: TEditCharCase read FCharCase write SetCharCase;
|
||||
property DroppedDown: Boolean read GetDroppedDown write SetDroppedDown;
|
||||
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
|
||||
procedure SelectAll;
|
||||
@ -341,6 +354,8 @@ type
|
||||
read FAutoCompleteText write FAutoCompleteText;
|
||||
property AutoDropDown: Boolean
|
||||
read FAutoDropDown write FAutoDropDown default False;
|
||||
property AutoSelect: Boolean read FAutoSelect write FAutoSelect default False;
|
||||
property AutoSelected: Boolean read FAutoSelected write FAutoSelected;
|
||||
property ArrowKeysTraverseList: Boolean read FArrowKeysTraverseList
|
||||
write SetArrowKeysTraverseList default True;
|
||||
property Canvas: TCanvas read FCanvas;
|
||||
@ -367,7 +382,9 @@ type
|
||||
property AutoComplete;
|
||||
property AutoCompleteText;
|
||||
property AutoDropDown;
|
||||
property AutoSelect;
|
||||
property BorderSpacing;
|
||||
property CharCase;
|
||||
property Ctl3D;
|
||||
property DropDownCount;
|
||||
property Enabled;
|
||||
@ -548,6 +565,8 @@ type
|
||||
property ClickOnSelChange;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property DragCursor;
|
||||
property DragMode;
|
||||
property ExtendedSelect;
|
||||
property Enabled;
|
||||
property Font;
|
||||
@ -588,15 +607,12 @@ type
|
||||
end;
|
||||
|
||||
|
||||
{ TCustomEdit }
|
||||
|
||||
TEditCharCase = (ecNormal, ecUppercase, ecLowerCase);
|
||||
TEchoMode = (emNormal, emNone, emPassword);
|
||||
|
||||
{ TCustomEdit }
|
||||
|
||||
TCustomEdit = class(TWinControl)
|
||||
private
|
||||
FAutoSelect: Boolean;
|
||||
FAutoSelected: Boolean;
|
||||
FCharCase: TEditCharCase;
|
||||
FEchoMode: TEchoMode;
|
||||
FMaxLength: Integer;
|
||||
@ -618,6 +634,8 @@ type
|
||||
procedure CreateWnd; override;
|
||||
procedure TextChanged; override;
|
||||
procedure Change; dynamic;
|
||||
procedure DoEnter; override;
|
||||
procedure DoExit; override;
|
||||
function GetSelLength: integer; virtual;
|
||||
function GetSelStart: integer; virtual;
|
||||
function GetSelText: string; virtual;
|
||||
@ -630,6 +648,9 @@ type
|
||||
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
procedure WMChar(var Message: TLMChar); message LM_CHAR;
|
||||
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer); override;
|
||||
property AutoSelect: Boolean read FAutoSelect write FAutoSelect default False;
|
||||
property AutoSelected: Boolean read FAutoSelected write FAutoSelected;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure Clear;
|
||||
@ -721,11 +742,14 @@ type
|
||||
{ TEdit }
|
||||
|
||||
TEdit = class(TCustomEdit)
|
||||
public
|
||||
property AutoSelected;
|
||||
published
|
||||
property Action;
|
||||
property Align;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property AutoSelect;
|
||||
property BorderSpacing;
|
||||
property Color;
|
||||
property Constraints;
|
||||
|
Loading…
Reference in New Issue
Block a user