patch from Michal Gawrycki - see 0026325: Proposition: RxDBGrid and AutoSort without sort engine

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3168 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2014-06-14 07:16:52 +00:00
parent f4f860abc2
commit bb44723bea
5 changed files with 58 additions and 43 deletions

View File

@ -75,8 +75,8 @@ msgstr "Campo '%s' no usado en expresión de filtro"
#: rxdconst.sexprbadnulltest
#, fuzzy
#| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'"
#| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'"
msgstr "Valor nulo habilitado en '=' y '<>'"
#: rxdconst.sexprexpected
@ -294,15 +294,6 @@ msgstr "Hacia Delante"
msgid "Text to find"
msgstr "Texto a Buscar"
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr "Aceptar"
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr ""
#: rxdconst.srxdbgridselcolcaption
msgid "Grid columns"
msgstr "Columnas de la Tabla"

View File

@ -74,7 +74,7 @@ msgid "Field '%s' not used in filter expression"
msgstr ""
#: rxdconst.sexprbadnulltest
msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'"
msgstr ""
#: rxdconst.sexprexpected
@ -292,15 +292,6 @@ msgstr ""
msgid "Text to find"
msgstr ""
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr ""
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr ""
#: rxdconst.srxdbgridselcolcaption
msgid "Grid columns"
msgstr ""

View File

@ -75,8 +75,8 @@ msgstr "Поле '%s' не может быть использовано в вы
#: rxdconst.sexprbadnulltest
#, fuzzy
#| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'"
#| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'"
msgstr "NULL-значения разрешены только в выражениях '=' и '<>'"
#: rxdconst.sexprexpected
@ -294,15 +294,6 @@ msgstr "Вперёд"
msgid "Text to find"
msgstr "Текст для поиска"
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr "Применить"
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr "Применить текущие параметры столбцов таблицы"
#: rxdconst.srxdbgridselcolcaption
msgid "Grid columns"
msgstr "Поля таблицы"

View File

@ -84,8 +84,8 @@ msgstr "Поле '%s' не може бути використане в вира
#: rxdconst.sexprbadnulltest
#, fuzzy
#| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'"
#| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'"
msgstr "NULL-значення дозволені тільки у виразах '=' і '<>'"
#: rxdconst.sexprexpected
@ -303,15 +303,6 @@ msgstr "Вперед"
msgid "Text to find"
msgstr "Текст для пошуку"
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr "Застосувати"
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr ""
#: rxdconst.srxdbgridselcolcaption
msgid "Grid columns"
msgstr "Поля таблиці"

View File

@ -553,6 +553,8 @@ type
FQuickUTF8Search: string;
FOldDataSetState:TDataSetState;
FOnSortChanged: TNotifyEvent;
procedure DoCreateJMenu;
//function GetAllowedOperations: TRxDBGridAllowedOperations;
function GetColumns: TRxDbGridColumns;
@ -714,6 +716,8 @@ type
procedure InvertSelection;
procedure CopyCellValue;
procedure SetSort(AFields: array of String; ASortMarkers: array of TSortMarker; PreformSort: Boolean = False);
property Canvas;
property DefaultTextStyle;
property EditorBorderStyle;
@ -761,6 +765,8 @@ type
property OnFiltred: TNotifyEvent read FOnFiltred write FOnFiltred;
// property Constraints:TRxDBGridCollumnConstraints read GetConstraints write SetConstraints;
property OnSortChanged: TNotifyEvent read FOnSortChanged write FOnSortChanged;
//from DBGrid
property Align;
property AlternateColor;
@ -3399,6 +3405,12 @@ begin
CollumnSortListUpdate;
if Assigned(FSortEngine) then
CollumnSortListApply;
if Assigned(FOnSortChanged) then
begin
FSortingNow := True;
FOnSortChanged(Self);
FSortingNow := False;
end;
end
else
HeaderClick(True, ACol);
@ -4467,6 +4479,12 @@ begin
Exclude(FOptionsRx, rdgCaseInsensitiveSort);
CollumnSortListApply;
if Assigned(FOnSortChanged) then
begin
FSortingNow := True;
FOnSortChanged(Self);
FSortingNow := False;
end;
end;
finally
@ -4714,6 +4732,39 @@ begin
OnCopyCellValue(Self);
end;
procedure TRxDBGrid.SetSort(AFields: array of String;
ASortMarkers: array of TSortMarker; PreformSort: Boolean);
var
I: Integer;
C: TRxColumn;
begin
CollumnSortListClear;
if (Length(AFields) > 0) and (Length(AFields) = Length(ASortMarkers)) then
begin
for I := 0 to Length(AFields) - 1 do
begin
C := ColumnByFieldName(AFields[I]);
if C <> nil then
begin
C.SortOrder := ASortMarkers[I];
C.FSortPosition := I;
end;
end;
CollumnSortListUpdate;
end;
if PreformSort then
begin
if Assigned(FSortEngine) then
CollumnSortListApply;
if Assigned(FOnSortChanged) then
begin
FSortingNow := True;
FOnSortChanged(Self);
FSortingNow := False;
end;
end;
end;
//!!!
constructor TRxDBGrid.Create(AOwner: TComponent);
begin