~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to lcl/include/customdblistbox.inc

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
{ Private Methods }
25
25
 
26
 
//update the Selected item on next record etc...
27
 
procedure TCustomDBListBox.DataChange(Sender: TObject);
28
 
begin
29
 
  //
30
 
end;
31
 
 
32
 
procedure TCustomDBListBox.EditingChange(Sender: TObject);
33
 
begin
34
 
  //
35
 
end;
36
 
 
37
 
procedure TCustomDBListBox.UpdateData(Sender: TObject);
38
 
begin
39
 
  //
40
 
end;
41
 
 
42
 
procedure TCustomDBListBox.FocusRequest(Sender: TObject);
43
 
begin
44
 
  //the FieldLink has requested the control
45
 
  //recieve focus for some reason..
46
 
  //perhaps an error occured?
47
 
  SetFocus;
48
 
end;
49
 
 
50
26
function TCustomDBListBox.GetDataField: string;
51
27
begin
52
28
  Result := FDataLink.FieldName;
107
83
procedure TCustomDBListBox.KeyDown(var Key: Word; Shift: TShiftState);
108
84
begin
109
85
  inherited KeyDown(Key,Shift);
110
 
  if Key=VK_ESCAPE then begin
111
 
    //cancel out of editing by reset on esc
112
 
    FDataLink.Reset;
113
 
    Key := VK_UNKNOWN;
114
 
  end else if (Key<>VK_UNKNOWN) then begin
115
 
    //make sure we call edit to ensure the datset is in edit,
116
 
    //this is for where the datasource is in autoedit, so we aren't
117
 
    //read only even though the dataset isn't really in edit
118
 
    //if this validates false make sure the entry doesn't change
119
 
    //since listbox doesn't have its own read only yet we gots to fake it
120
 
    //here
121
 
    if FDataLink.Edit then
122
 
       exit;
123
 
    Key := VK_UNKNOWN;
 
86
  case Key of
 
87
  VK_ESCAPE:
 
88
    begin
 
89
      //cancel out of editing by reset on esc
 
90
      FDataLink.Reset;
 
91
      Key := VK_UNKNOWN;
 
92
    end;
 
93
  VK_DOWN, VK_UP:
 
94
    begin
 
95
      FDataLink.Edit;
 
96
    end;
124
97
  end;
125
98
end;
126
99
 
127
 
procedure TCustomDBListBox.Loaded;
128
 
begin
129
 
  inherited Loaded;
130
 
  //need to make sure the state is updated on first load
131
 
  if (csDesigning in ComponentState) then
132
 
    DataChange(Self);
133
 
end;
134
 
 
135
 
procedure TCustomDBListBox.Notification(AComponent: TComponent;
136
 
  Operation: TOperation);
 
100
procedure TCustomDBListBox.Notification(AComponent: TComponent; Operation: TOperation);
137
101
begin
138
102
  inherited Notification(AComponent, Operation);
139
103
  // if the datasource is being removed then we need to make sure
145
109
  end;
146
110
end;
147
111
 
148
 
procedure TCustomDBListBox.Click;
149
 
begin
150
 
  //make sure we are in modify mode if can edit
151
 
  //so if a user changed the selection it can be
152
 
  //updated, and if not canel out ala ReadOnly
153
 
  if not FDataLink.Edit then
154
 
  begin
155
 
    // restore value
156
 
    DataChange(self);
157
 
    Exit;
158
 
  end;
159
 
  inherited Click;
160
 
  FDataLink.Modified;
161
 
end;
162
 
 
163
 
procedure TCustomDBListBox.EditingDone;
164
 
begin
165
 
  FDataLink.UpdateRecord;
166
 
  inherited EditingDone;
167
 
end;
168
 
 
169
112
{ Public Methods }
170
113
constructor TCustomDBListBox.Create(AOwner: TComponent);
171
114
begin
173
116
  FDataLink := TFieldDataLink.Create;
174
117
  FDataLink.Control := Self;
175
118
  FDataLink.OnDataChange := @DataChange;
176
 
  FDataLink.OnEditingChange := @EditingChange;
177
119
  FDataLink.OnUpdateData := @UpdateData;
178
120
end;
179
121
 
180
122
destructor TCustomDBListBox.Destroy;
181
123
begin
182
 
  FDataLink.Free;
183
 
  FDataLink := nil;
 
124
  FDataLink.Destroy;
184
125
  inherited Destroy;
185
126
end;
186
127