jvcllaz: Add LookupAutoComplete component.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6890 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-05-04 21:53:45 +00:00
parent 2e29cc575c
commit de0f60e1a8
13 changed files with 1191 additions and 8 deletions

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="JvLookupAutoCompleteDemo"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="JvCtrlsLazR"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units>
<Unit>
<Filename Value="JvLookupAutoCompleteDemo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="..\..\bin\JvLookupAutoCompleteDemo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,22 @@
program JvLookupAutoCompleteDemo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,140 @@
object Form1: TForm1
Left = 326
Height = 398
Top = 128
Width = 418
AutoSize = True
Caption = 'JvLookupAutoComplete demo'
ClientHeight = 398
ClientWidth = 418
OnCreate = FormCreate
LCLVersion = '2.1.0.0'
object Edit1: TEdit
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
Left = 16
Height = 23
Top = 50
Width = 176
BorderSpacing.Top = 4
TabOrder = 0
end
object ListBox1: TListBox
AnchorSideLeft.Control = Edit1
AnchorSideTop.Control = Edit1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Edit1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 16
Height = 281
Top = 81
Width = 176
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
BorderSpacing.Bottom = 16
Constraints.MinHeight = 250
Items.Strings = (
'ListBox'
'ComboBox'
'Edit'
'ListView'
'TreeView'
'ScrollBar'
'ScrollBox'
'StatusBar'
'ToolBar'
'Menu'
'PopupMenu'
'Button'
'BitBtn'
'SpeedButton'
)
ItemHeight = 15
Options = []
TabOrder = 1
end
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom
Left = 16
Height = 15
Top = 31
Width = 66
BorderSpacing.Left = 16
BorderSpacing.Top = 4
Caption = 'listbox items'
ParentColor = False
WordWrap = True
end
object Label2: TLabel
AnchorSideLeft.Control = Edit1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label1
Left = 208
Height = 15
Top = 31
Width = 77
BorderSpacing.Left = 16
Caption = 'stringlist items'
ParentColor = False
WordWrap = True
end
object Edit2: TEdit
AnchorSideLeft.Control = Label2
AnchorSideTop.Control = Edit1
Left = 208
Height = 23
Top = 50
Width = 168
BorderSpacing.Right = 16
TabOrder = 2
end
object Label3: TLabel
AnchorSideLeft.Control = Edit2
AnchorSideTop.Control = ListBox1
AnchorSideRight.Control = Edit2
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ListBox1
AnchorSideBottom.Side = asrBottom
Left = 208
Height = 281
Top = 81
Width = 168
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = False
Caption = 'Type listbox items into the edit controls and see autocompletion.'
Layout = tlCenter
ParentColor = False
WordWrap = True
end
object Label4: TLabel
AnchorSideLeft.Control = Edit1
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Edit2
AnchorSideRight.Side = asrBottom
Left = 16
Height = 15
Top = 12
Width = 360
Alignment = taCenter
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 12
Caption = 'Autocompletion based on...'
ParentColor = False
end
object JvLookupAutoComplete1: TJvLookupAutoComplete
Edit = Edit1
ListBox = ListBox1
left = 80
top = 304
end
object JvLookupAutoComplete2: TJvLookupAutoComplete
Edit = Edit2
Kind = akStrings
left = 272
top = 304
end
end

View File

@@ -0,0 +1,47 @@
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
JvAutoComplete;
type
{ TForm1 }
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
JvLookupAutoComplete1: TJvLookupAutoComplete;
JvLookupAutoComplete2: TJvLookupAutoComplete;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
JvLookupAutoComplete2.Strings.Assign(ListBox1.Items);
end;
end.