mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 03:58:16 +01:00
added TComboBox.AutoCompleteText feature
git-svn-id: trunk@8483 -
This commit is contained in:
parent
b6c54cb6ea
commit
4d6ed5f8b2
24
Makefile
24
Makefile
@ -348,6 +348,12 @@ endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override TARGET_UNITS+=runtimetypeinfocontrols.pas
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override TARGET_UNITS+=printer4lazarus.pas
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override TARGET_UNITS+=runtimetypeinfocontrols.pas
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
override TARGET_PROGRAMS+=lazarus startlazarus
|
||||
endif
|
||||
@ -459,6 +465,12 @@ endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
override TARGET_EXAMPLEDIRS+=examples
|
||||
endif
|
||||
@ -570,6 +582,12 @@ endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override COMPILER_OPTIONS+=-gl
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override COMPILER_OPTIONS+=-gl
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override COMPILER_OPTIONS+=-gl
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||
endif
|
||||
@ -3356,6 +3374,12 @@ endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override COMPILER_UNITDIR+=../../ideintf/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override COMPILER_UNITDIR+=$(OS_TARGET)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override COMPILER_UNITDIR+=../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
TARGET_EXAMPLEDIRS_EXAMPLES=1
|
||||
endif
|
||||
|
||||
@ -430,6 +430,32 @@ begin
|
||||
inherited KeyDown(Key, Shift);
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
var iSelStart: Integer;
|
||||
sCompleteText: string;
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
if ((cbactEnabled in FAutoCompleteText) and (Style = csDropDown)) 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 (Key = VK_RETURN) then
|
||||
SelectAll else
|
||||
begin
|
||||
iSelStart := SelStart;//Capture original cursor position
|
||||
sCompleteText := GetCompleteText(Text, iSelStart,
|
||||
(cbactSearchCaseSensitive in FAutoCompleteText),
|
||||
(cbactSearchAscending in FAutoCompleteText), Items);
|
||||
if not (sCompleteText = Text) then
|
||||
begin
|
||||
Text := sCompleteText;
|
||||
SelStart := iSelStart;
|
||||
SelLength := Length(Text);
|
||||
end;//End if not (sCompleteText = Text)
|
||||
end;//End if (Key = VK_RETURN)
|
||||
end;//End if ((cbactEnabled in FAutoCompleteText) and (Style = csDropDown))
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TCustomComboBox.SelectItem(const AnItem: String): Boolean;
|
||||
|
||||
@ -578,6 +604,7 @@ begin
|
||||
ArrowKeysTraverseList := True;
|
||||
TabStop := true;
|
||||
ParentColor := false;
|
||||
FAutoCompleteText := [cbactSearchAscending];
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
||||
@ -211,6 +211,8 @@ type
|
||||
|
||||
|
||||
{ TCustomComboBox }
|
||||
TComboBoxAutoCompleteTextSet = (cbactEnabled, cbactSearchCaseSensitive, cbactSearchAscending);
|
||||
TComboBoxAutoCompleteText = set of TComboBoxAutoCompleteTextSet;
|
||||
|
||||
TComboBoxStyle = (csDropDown, csSimple, csDropDownList, csOwnerDrawFixed,
|
||||
csOwnerDrawVariable);
|
||||
@ -226,6 +228,7 @@ type
|
||||
|
||||
TCustomComboBox = class(TWinControl)
|
||||
private
|
||||
FAutoCompleteText: TComboBoxAutoCompleteText;
|
||||
FAutoDropDown: Boolean;
|
||||
FCanvas: TCanvas;
|
||||
FDropDownCount: Integer;
|
||||
@ -292,6 +295,7 @@ type
|
||||
procedure SetStyle(Val: TComboBoxStyle); virtual;
|
||||
procedure RealSetText(const AValue: TCaption); override;
|
||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
function SelectItem(const AnItem: String): Boolean;
|
||||
|
||||
property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
|
||||
@ -319,7 +323,8 @@ type
|
||||
property DroppedDown: Boolean read GetDroppedDown write SetDroppedDown;
|
||||
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
|
||||
procedure SelectAll;
|
||||
|
||||
property AutoCompleteText: TComboBoxAutoCompleteText
|
||||
read FAutoCompleteText write FAutoCompleteText;
|
||||
property AutoDropDown: Boolean
|
||||
read FAutoDropDown write FAutoDropDown default False;
|
||||
property ArrowKeysTraverseList: Boolean read FArrowKeysTraverseList
|
||||
@ -345,6 +350,7 @@ type
|
||||
property Align;
|
||||
property Anchors;
|
||||
property ArrowKeysTraverseList;
|
||||
property AutoCompleteText;
|
||||
property AutoDropDown;
|
||||
property BorderSpacing;
|
||||
property Ctl3D;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user