mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 19:07:27 +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)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override TARGET_UNITS+=runtimetypeinfocontrols.pas
|
override TARGET_UNITS+=runtimetypeinfocontrols.pas
|
||||||
endif
|
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)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_PROGRAMS+=lazarus startlazarus
|
override TARGET_PROGRAMS+=lazarus startlazarus
|
||||||
endif
|
endif
|
||||||
@ -459,6 +465,12 @@ endif
|
|||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
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))
|
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||||
endif
|
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)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_EXAMPLEDIRS+=examples
|
override TARGET_EXAMPLEDIRS+=examples
|
||||||
endif
|
endif
|
||||||
@ -570,6 +582,12 @@ endif
|
|||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override COMPILER_OPTIONS+=-gl
|
override COMPILER_OPTIONS+=-gl
|
||||||
endif
|
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)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
|
||||||
endif
|
endif
|
||||||
@ -3356,6 +3374,12 @@ endif
|
|||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
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)/ ./
|
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
|
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)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
TARGET_EXAMPLEDIRS_EXAMPLES=1
|
TARGET_EXAMPLEDIRS_EXAMPLES=1
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -430,6 +430,32 @@ begin
|
|||||||
inherited KeyDown(Key, Shift);
|
inherited KeyDown(Key, Shift);
|
||||||
end;
|
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;
|
function TCustomComboBox.SelectItem(const AnItem: String): Boolean;
|
||||||
|
|
||||||
@ -578,6 +604,7 @@ begin
|
|||||||
ArrowKeysTraverseList := True;
|
ArrowKeysTraverseList := True;
|
||||||
TabStop := true;
|
TabStop := true;
|
||||||
ParentColor := false;
|
ParentColor := false;
|
||||||
|
FAutoCompleteText := [cbactSearchAscending];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -211,6 +211,8 @@ type
|
|||||||
|
|
||||||
|
|
||||||
{ TCustomComboBox }
|
{ TCustomComboBox }
|
||||||
|
TComboBoxAutoCompleteTextSet = (cbactEnabled, cbactSearchCaseSensitive, cbactSearchAscending);
|
||||||
|
TComboBoxAutoCompleteText = set of TComboBoxAutoCompleteTextSet;
|
||||||
|
|
||||||
TComboBoxStyle = (csDropDown, csSimple, csDropDownList, csOwnerDrawFixed,
|
TComboBoxStyle = (csDropDown, csSimple, csDropDownList, csOwnerDrawFixed,
|
||||||
csOwnerDrawVariable);
|
csOwnerDrawVariable);
|
||||||
@ -226,6 +228,7 @@ type
|
|||||||
|
|
||||||
TCustomComboBox = class(TWinControl)
|
TCustomComboBox = class(TWinControl)
|
||||||
private
|
private
|
||||||
|
FAutoCompleteText: TComboBoxAutoCompleteText;
|
||||||
FAutoDropDown: Boolean;
|
FAutoDropDown: Boolean;
|
||||||
FCanvas: TCanvas;
|
FCanvas: TCanvas;
|
||||||
FDropDownCount: Integer;
|
FDropDownCount: Integer;
|
||||||
@ -292,6 +295,7 @@ type
|
|||||||
procedure SetStyle(Val: TComboBoxStyle); virtual;
|
procedure SetStyle(Val: TComboBoxStyle); virtual;
|
||||||
procedure RealSetText(const AValue: TCaption); override;
|
procedure RealSetText(const AValue: TCaption); override;
|
||||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
|
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||||
function SelectItem(const AnItem: String): Boolean;
|
function SelectItem(const AnItem: String): Boolean;
|
||||||
|
|
||||||
property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
|
property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
|
||||||
@ -319,7 +323,8 @@ type
|
|||||||
property DroppedDown: Boolean read GetDroppedDown write SetDroppedDown;
|
property DroppedDown: Boolean read GetDroppedDown write SetDroppedDown;
|
||||||
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
|
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
|
||||||
procedure SelectAll;
|
procedure SelectAll;
|
||||||
|
property AutoCompleteText: TComboBoxAutoCompleteText
|
||||||
|
read FAutoCompleteText write FAutoCompleteText;
|
||||||
property AutoDropDown: Boolean
|
property AutoDropDown: Boolean
|
||||||
read FAutoDropDown write FAutoDropDown default False;
|
read FAutoDropDown write FAutoDropDown default False;
|
||||||
property ArrowKeysTraverseList: Boolean read FArrowKeysTraverseList
|
property ArrowKeysTraverseList: Boolean read FArrowKeysTraverseList
|
||||||
@ -345,6 +350,7 @@ type
|
|||||||
property Align;
|
property Align;
|
||||||
property Anchors;
|
property Anchors;
|
||||||
property ArrowKeysTraverseList;
|
property ArrowKeysTraverseList;
|
||||||
|
property AutoCompleteText;
|
||||||
property AutoDropDown;
|
property AutoDropDown;
|
||||||
property BorderSpacing;
|
property BorderSpacing;
|
||||||
property Ctl3D;
|
property Ctl3D;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user