On Monday 24 October 2016 09:29:56 mohamed hamza wrote:
> Hi Martin,
>
>     Thanks for your advice. Now the column is sorted , But when I click on
> heading arrow this one becomes unsorted instead desc sort and I can not
> return back to sorted column?
>
Works for me, please send an example with tlocaldataset or tsqlite3connection 
which shows the problem.

>  Note: I can not set optionsgrid.og_sorted to true?
>
This probably is OK, tdbgrid can not be internally sorted because it has rows 
for the visible range of records only -> it removes og_sorted from 
optionsgrid.

"
procedure tcustomdbwidgetgrid.setoptionsgrid(const avalue: optionsgridty);
begin
 inherited setoptionsgrid(fdatalink.updateoptionsgrid(avalue));
end;

function tgriddatalink.updateoptionsgrid(const avalue: optionsgridty): 
optionsgridty;
begin
 result:= avalue - [og_sorted];
 with tcustomgrid1(fgrid) do begin
  if og_sorted in avalue then begin
   if not (gs1_dbsorted in fstate1) then begin
    include(fstate1,gs1_dbsorted);
    invalidate;
   end
  end
  else begin
   if gs1_dbsorted in fstate1 then begin
    exclude(fstate1,gs1_dbsorted);
    updatesortfield(nil,false);
    invalidate;
   end;
  end;
 end;
end;
"

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to