fix rxdbgrid

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1004 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2009-11-12 21:22:17 +00:00
parent 707600eeba
commit c82ec8e4df
5 changed files with 37 additions and 22 deletions

View File

@ -36,6 +36,7 @@
- Исправлено изменение цвета конца недели в RxDateEdit - Исправлено изменение цвета конца недели в RxDateEdit
+ Добавлена демка для RxDBLookup + Добавлена демка для RxDBLookup
+ У объекта TRxDBLookupCombo опубликовано свойство Text - установка значения для него вызывает поиск по лукап-листу + У объекта TRxDBLookupCombo опубликовано свойство Text - установка значения для него вызывает поиск по лукап-листу
+ Локальная фильтрация в RxDBGrid-е использует значения Field.DisplayText, а не Field.AsString
22.05.2008 - версия 2.0.0.136 (svn revision 100) 22.05.2008 - версия 2.0.0.136 (svn revision 100)
+ У объекта TRxCustomDBLookupCombo введён контроль на CircularDataLink + У объекта TRxCustomDBLookupCombo введён контроль на CircularDataLink
+ У объекта TRxCustomDBLookupCombo ускорена отрисовка данных + У объекта TRxCustomDBLookupCombo ускорена отрисовка данных

View File

@ -116,7 +116,9 @@ type
property Values: TStrings read FValues write SetValues; property Values: TStrings read FValues write SetValues;
property Visible; property Visible;
property OnChange; property OnChange;
property OnChangeBounds;
property OnClick; property OnClick;
property OnCloseUp;
property OnDblClick; property OnDblClick;
property OnDragDrop; property OnDragDrop;
property OnDragOver; property OnDragOver;
@ -129,7 +131,12 @@ type
property OnKeyPress; property OnKeyPress;
property OnKeyUp; property OnKeyUp;
property OnMeasureItem; property OnMeasureItem;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnSelect;
property OnStartDrag; property OnStartDrag;
property OnUTF8KeyPress;
property OnContextPopup; property OnContextPopup;
property OnEndDock; property OnEndDock;
property OnStartDock; property OnStartDock;
@ -236,9 +243,9 @@ end;
procedure TCustomDBComboBox.Change; procedure TCustomDBComboBox.Change;
begin begin
FDataLink.Edit; FDataLink.Edit;
inherited Change;
FDataLink.Modified; FDataLink.Modified;
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
inherited Change;
end; end;
procedure TCustomDBComboBox.Click; procedure TCustomDBComboBox.Click;

View File

@ -360,6 +360,7 @@ type
procedure ShowFindDialog; procedure ShowFindDialog;
procedure ShowColumnsDialog; procedure ShowColumnsDialog;
function ColumnByFieldName(AFieldName:string):TRxColumn; function ColumnByFieldName(AFieldName:string):TRxColumn;
function ColumnByCaption(ACaption:string):TRxColumn;
property Canvas; property Canvas;
property DefaultTextStyle; property DefaultTextStyle;
property EditorBorderStyle; property EditorBorderStyle;
@ -1236,24 +1237,11 @@ begin
C:=TRxColumn(Columns[i]); C:=TRxColumn(Columns[i]);
FPropertyStorageLink.Storage.WriteString(S1+sCaption, StrToHexText(C.Title.Caption)); FPropertyStorageLink.Storage.WriteString(S1+sCaption, StrToHexText(C.Title.Caption));
FPropertyStorageLink.Storage.WriteInteger(S1+sWidth, C.Width); FPropertyStorageLink.Storage.WriteInteger(S1+sWidth, C.Width);
FPropertyStorageLink.Storage.WriteInteger(S1+sIndex, C.Index);
end; end;
end; end;
procedure TRxDBGrid.OnIniLoad(Sender: TObject); procedure TRxDBGrid.OnIniLoad(Sender: TObject);
function GetColByCaption(Cap:string):TRxColumn;
var
i:integer;
begin
Result:=nil;
for i:=0 to Columns.Count - 1 do
if Cap = Columns[i].Title.Caption then
begin
Result:=TRxColumn(Columns[i]);
exit;
end;
end;
var var
i, ACount:integer; i, ACount:integer;
S, S1, ColumName:string; S, S1, ColumName:string;
@ -1272,9 +1260,13 @@ begin
ColumName:=HexTextToStr(FPropertyStorageLink.Storage.ReadString(S1+sCaption, '')); ColumName:=HexTextToStr(FPropertyStorageLink.Storage.ReadString(S1+sCaption, ''));
if ColumName<>'' then if ColumName<>'' then
begin begin
C:=GetColByCaption(ColumName); C:=ColumnByCaption(ColumName);
if Assigned(C) then if Assigned(C) then
begin
C.Width:=FPropertyStorageLink.Storage.ReadInteger(S1+sWidth, C.Width); C.Width:=FPropertyStorageLink.Storage.ReadInteger(S1+sWidth, C.Width);
C.Visible:=FPropertyStorageLink.Storage.ReadInteger(S1+sVisible, Ord(C.Visible)) = 1;
C.Index:=FPropertyStorageLink.Storage.ReadInteger(S1+sIndex, C.Index);
end;
end; end;
end; end;
end; end;
@ -2398,7 +2390,7 @@ begin
for i:=0 to Columns.Count-1 do for i:=0 to Columns.Count-1 do
begin begin
with TRxColumn(Columns[i]) do with TRxColumn(Columns[i]) do
if (Filter.Value<>'') and (Filter.Value<>Field.AsString) then if (Filter.Value<>'') and (Filter.Value<>Field.DisplayText) then
begin begin
Accept:=false; Accept:=false;
break; break;
@ -2524,8 +2516,8 @@ begin
for i:=0 to Columns.Count-1 do for i:=0 to Columns.Count-1 do
begin begin
C:=TRxColumn(Columns[i]); C:=TRxColumn(Columns[i]);
if (C.Field<>nil) and (C.Filter.ValueList.IndexOf(C.Field.AsString)<0) then if (C.Field<>nil) and (C.Filter.ValueList.IndexOf(C.Field.DisplayText)<0) then
C.Filter.ValueList.Add(C.Field.AsString); C.Filter.ValueList.Add(C.Field.DisplayText);
end; end;
DataSource.DataSet.Next; DataSource.DataSet.Next;
end; end;
@ -2696,6 +2688,19 @@ begin
end; end;
end; end;
function TRxDBGrid.ColumnByCaption(ACaption: string): TRxColumn;
var
i:integer;
begin
Result:=nil;
for i:=0 to Columns.Count - 1 do
if ACaption = Columns[i].Title.Caption then
begin
Result:=TRxColumn(Columns[i]);
exit;
end;
end;
{ TRxDbGridColumns } { TRxDbGridColumns }
function TRxDbGridColumns.Add: TRxColumn; function TRxDbGridColumns.Add: TRxColumn;
begin begin
@ -3286,6 +3291,7 @@ begin
FFont := TFont.Create; FFont := TFont.Create;
FEmptyFont := TFont.Create; FEmptyFont := TFont.Create;
FValueList := TStringList.Create; FValueList := TStringList.Create;
FValueList.Sorted:=true;
FColor := clWhite; FColor := clWhite;
// FColor := clSkyBlue; // FColor := clSkyBlue;

View File

@ -151,7 +151,8 @@ const
sButtonAllign = '.ButtonAllign'; sButtonAllign = '.ButtonAllign';
sOptions = '.Options'; sOptions = '.Options';
sCaption = '.Caption'; sCaption = '.Caption';
sIndex = '.Index';
implementation implementation

View File

@ -7,7 +7,7 @@ interface
uses uses
LCLType, LCLProc, LCLIntf, Classes, SysUtils, LResources, Forms, LCLType, LCLProc, LCLIntf, Classes, SysUtils, LResources, Forms,
Controls, Graphics, Dialogs, DB, EditBtn, DBGrids, StdCtrls, Buttons, Controls, Graphics, Dialogs, DB, EditBtn, DBGrids, StdCtrls, Buttons,
LMessages, DbCtrls, GraphType, dbutils, RxDbGrid, rxpopupunit; LMessages, DbCtrls, GraphType, dbutils, RxDbGrid, rxpopupunit, Themes;
const const
TextMargin = 5; TextMargin = 5;
@ -1358,7 +1358,7 @@ begin
RxFrame3D(Canvas, R, clWindowFrame, clBtnHighlight, 1); RxFrame3D(Canvas, R, clWindowFrame, clBtnHighlight, 1);
RxFrame3D(Canvas, R, clBtnShadow, clBtnFace, 1); RxFrame3D(Canvas, R, clBtnShadow, clBtnFace, 1);
end; end;
if ClientWidth > 6 then if ClientWidth > 6 then
begin begin
SetRect(R1, 3, 3, ClientWidth - 3, ClientHeight - 3); SetRect(R1, 3, 3, ClientWidth - 3, ClientHeight - 3);