CRDBGrid Summary & Title display/refresh problem

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

CRDBGrid Summary & Title display/refresh problem

Post by ertank » Sun 24 Jan 2016 07:05

Hi,

I am using Delphi 10, compiling 32bit, and have following tables in MSSQL Express 2014 64bit

Code: Select all

CREATE TABLE PDKS_DETAY(
	AdresKodu nvarchar(30) NOT NULL,
	Tarih date NOT NULL,
	PersonelTCNo nvarchar(15) NOT NULL,
	Yil smallint NOT NULL,
	Ay smallint NOT NULL,
	Hafta smallint NOT NULL,
	Gun smallint NOT NULL,
	KaydiGiren nvarchar(10) NOT NULL,
	BaslangicSaati datetime NOT NULL,
	BitisSaati datetime NOT NULL,
	MolaSuresi datetime NOT NULL,
	NetCalismaSaati datetime,
	Yevmiye smallmoney NOT NULL,
	OnaylananYevmiye smallmoney,
	Prim smallmoney,
	OnaylananYevmiyeNotu nvarchar(30),
	KayitZamaniIlk datetime NOT NULL,
	KayitZamaniDegisiklik datetime,
	KaydiGirenIlk nvarchar(10) NOT NULL,
	PRIMARY KEY (AdresKodu, Tarih, PersonelTCNo)
)

Code: Select all

CREATE TABLE PERSONEL(
	TCNo nvarchar(15) NOT NULL,
	SicilNo nvarchar(15) NOT NULL,
	SGKNo nvarchar(15) NULL,
	Ad nvarchar(30) NOT NULL,
	Soyad nvarchar(40) NOT NULL,
	OncekiSoyadi nvarchar(40),
	DogumTarihi date NOT NULL,
	Cinsiyet nchar(1) NOT NULL,
	Istihdam nvarchar(1) NOT NULL,
	CalismaDurumu nvarchar(5) NOT NULL,
	IseAldiran nvarchar(102) NOT NULL,
	Kaydeden nvarchar(102) NOT NULL,
	SonHareketTarihi date,
	EvTel nvarchar(20),
	CepTel nvarchar(20),
	Cep2Tel nvarchar(20),
	Cep3Tel nvarchar(20),
	Notlar nvarchar(2048),
	Adres1 nvarchar(50),
	Adres2 nvarchar(50),
	PostaKodu nvarchar(10),
	ILCE nvarchar(15),
	IL nvarchar(15),
	Aktif nchar(1) NOT NULL,
	BankaAdi nvarchar(20),
	SubeKodu nvarchar(10),
	SubeAdi nvarchar(20),
	BankaIL nvarchar(20),
	IBAN nvarchar(34),
	HesapNo nvarchar(16) 
)

ALTER TABLE PERSONEL WITH CHECK ADD CONSTRAINT [CK_PERSONEL] CHECK  (([Cinsiyet]='E' OR [Cinsiyet]='K'))

ALTER TABLE PERSONEL CHECK CONSTRAINT [CK_PERSONEL]
UniQuery has following dedicated SQL set at design-time and not changed by code at run-time:

Code: Select all

select a.*,(b.Ad+' '+B.Soyad) as "AdiSoyadi" from PDKS_DETAY a, PERSONEL b
where b.TCNo = a.PersonelTCNo
UniQuery is connected with UniDataSource and CRDBGrid is connected to that UniDataSource.

There are two TTimer components on this form. They are doing nothing related with Grid, and they are not Enabled by default. One is Enabled in Form.OnActivate and other one is Enabled after 1 minute. They are both disabled in about 70 seconds later and not Enabled again until next Form.OnActivate.

Following parameters are set for CRDBGrid:
Allign:= alBottom;
Height:= 114;
Options.dgEditing := False;
Options.dgRowSelect := True;
Options.dgAlwaysShowSelection := True;
OptionsEx.dgeSummary := True;
TabStop := False;

Following Columns are defined at Design-Time in CRDBGrid.
0 - PersonelTCNo
1 - AdiSoyadi
2 - BaslangicSaati
3 - BitisSaati
4 - MolaSuresi
5 - NetCalismaSaati
6 - Yemiye
7 - OnaylananYevmiye
8 - Prim

All Columns' Title.Allignment is set to taCenter. Columns Yevmiye, OnaylananYevmiye and Prim have property SummaryMode set to smSum.

All columns in SQL are defined as fields in UniQuery at degisn-time. No display mask set for Columns Yevmiye, OnaylananYevmiye and Prim. There are display masks for columns 2,3,4,5.

Running application, I have following Grid displayed on screen. Please pay attention to bottom summary section. There is nothing displayed there.

Image

However, I recognize that when I move my mouse pointer over that summary sections, I can see, just for the blink of an eye, numbers displayed. Then it is as in the picture above. What I suppose is grid re-drawing/painting itself with mouse moving over.

I also have same flickering at the title section of the Grid, too. Especially when Filter/Search bar is displayed that effect is easier to recognize. Not sure if that is by design or something that needs to be fixed.

I confirm that exactly same summary is displayed at design-time when UniQuery.Active = True. There is no flickering affect for both summary and title at design-time when I move my mouse pointer over.

I did not check if other summary properties (Avg, Min, Max, etc.) for Columns are same or not. I have a strong feeling that they will be same.

I appreciate if you can confirm that you are able to reproduce the problem.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: CRDBGrid Summary & Title display/refresh problem

Post by AlexP » Mon 25 Jan 2016 09:13

Hello,

Thank you for the sample. We have reproduce the issue and will investigate the reasons for such behavior. Currently, to solve the issue, you can disable the dgeRecordCount option in OptionsEx

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: CRDBGrid Summary & Title display/refresh problem

Post by AlexP » Tue 26 Jan 2016 08:31

This behavior is correct, since the other fields will be "erased" when the dgeRecordCount option is enabled. If you still need to return both the number of records and the field result, we can point you the code to edit in CRDBGrid.

ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

Re: CRDBGrid Summary & Title display/refresh problem

Post by ertank » Wed 27 Jan 2016 18:39

Yes please. I very much would like to be able to use summary together with record count.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: CRDBGrid Summary & Title display/refresh problem

Post by AlexP » Thu 28 Jan 2016 12:21

If the result is not calculated in the first column of the grid, you can just modify the PaintStatusLine method in the CRDBGrid module as follows:

after the lines

Code: Select all

if (dgeRecordCount in FOptionsEx) then begin
  CellRect := FullRect;
add a line

Code: Select all

CellRect.Right := Columns[0].Width;
If the first column contains a result, then it will be "wiped" when displaying the number of records.

ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

Re: CRDBGrid Summary & Title display/refresh problem

Post by ertank » Thu 28 Jan 2016 21:23

I'm assuming this won't be a parameter or something. Would be nice to know if that can be confirmed/denied.

Thanks.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: CRDBGrid Summary & Title display/refresh problem

Post by AlexP » Fri 29 Jan 2016 13:04

We no longer support (develop) CRDBGrid, just fix critical bugs. If you need a new functionality, you can implement it by yourself.

ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

Re: CRDBGrid Summary & Title display/refresh problem

Post by ertank » Wed 06 Jul 2016 20:04

AlexP wrote:If the result is not calculated in the first column of the grid, you can just modify the PaintStatusLine method in the CRDBGrid module as follows:

after the lines

Code: Select all

if (dgeRecordCount in FOptionsEx) then begin
  CellRect := FullRect;
add a line

Code: Select all

CellRect.Right := Columns[0].Width;
If the first column contains a result, then it will be "wiped" when displaying the number of records.

Just had time to do above work around.

I have found two places where search text found. Added suggested line bottom of both. Cleaned and recompiled both crcontrols and dclcrcontrols packages. Uninstalled, and installed again the dcl package. See the confirmation of TCRDBGrid is installed OK.

I still cannot see both RecordCount and summary of another column at the same time. Is there anything I can do?

Thanks.

Updated lines in the CRGrid.pas is as follows:
Line number 2654

Code: Select all

        if dgeRecordCount in FOptionsEx then begin
          CellRect := FullRect;
          CellRect.Right := Columns[0].Width;  // ADDED BY ERTAN 2016-07-06
          InflateRect(CellRect, -2, -2);
          if DataLink.Active then
            tmpText := IntToStr(DataLink.DataSet.RecNo) +
              '/' + IntToStr(DataLink.DataSet.RecordCount)
          else
            tmpText := '';//'Records count : INACTIVE';
          WriteText(Canvas, CellRect, 0, 0, tmpText, taLeftJustify,True);
        end;
Line number 2639

Code: Select all

          if dgeRecordCount in FOptionsEx
          then begin
            CellRect := FullRect;
			CellRect.Right := Columns[0].Width;  // ADDED BY ERTAN 2016-07-06
            InflateRect(CellRect, -2, -2);
            CellRect.Right := RightBorder;
            if DataLink.Active then
                tmpText := IntToStr(DataLink.DataSet.RecNo) +
                  '/' + IntToStr(DataLink.DataSet.RecordCount)
            else
                tmpText := '';//'Records count : INACTIVE';
            WriteText(Canvas, CellRect, 0, 0, tmpText, taLeftJustify,True);
          end;

Post Reply