Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 16 Apr 2024, 20:47

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 11 Jul 2021, 21:54 
Offline

Joined: 16 Dec 2020, 20:55
Posts: 3
I recently tried to replace the legacy TDbGrid with TDbGridEh across the project.
But after replacing the first grid I'm getting stuck with a screen lock without any known reason.
The grid header gets a black-colored label and the whole application is locked.

I have a panel in that form that shows a progress bar and hides it at the end of the job, I realized with a lot of trial and error that if I manually add records to MemTable and VCL styles are used(themes) at the same time, anything like The panel (including the progress bar inside) displayed on the grid will make this happen more often.
Without the panel and progress bar, the number of times this happens is reduced, but it is not zero, and if I do not use the style, it will happen much less.
I think something is wrong with the Grid's internal Draw methods because I didn't do a complex jib here, just replacing the Grid with the old one and replacing AdoQuery with MemTable.
Does anyone have such an experience or can anyone help me understand where the problem is?


Attachments:
Untitled.png
Untitled.png [ 70.01 KiB | Viewed 769 times ]
Top
 Profile  
 
PostPosted: 11 Jul 2021, 22:11 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

This can happen if you change grid properties in a render event.
This cannot be done.
Can you send a Demo or the source of your Form (dmf+pas) to support@ehlib.com?

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 11 Jul 2021, 22:27 
Offline

Joined: 16 Dec 2020, 20:55
Posts: 3
Well it takes time to make a demo, the data behind is complex and there are some external threads.
But yes I'm changing some cell's colors after the saving process in DrawColumnCell event of the grid that is very difficult to trace.
Some lines like:
Code:

  gridMain.Canvas.TextOut(L, Rect.Top + 2, icoPic.Caption); // printing some captions in a cell
  gridMain.Canvas.Draw(L, Rect.Top + 1, img.Picture.Graphic); // Drawing an icon in a cell


and also some others in the AdvDrawDataCell event.
Some lines like:
Code:
   Sender.Canvas.Font.Color := clGray;
   Sender.Canvas.Font.Style := [fsBold];
   Sender.Canvas.Brush.Color := clSilver;


By the way, I have removed STRFilter from some fields by code in the FormShow event.
Something like this line is handled just on form show time.
Code:
ADbGrid.Columns[I].STFilter.Visible := False;


Top
 Profile  
 
PostPosted: 12 Jul 2021, 09:10 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Changing the Canvas properties in the event is correct.
I do not see any problems in the given pieces of code.

To see the full picture it is better to have the complete code of the Form.

If you want to find the error yourself, try commenting out the code in the event handlers, and then uncommenting one or two lines at a time and see the result.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group