Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 21:07

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 16 Sep 2022, 11:20 
Offline

Joined: 09 Aug 2016, 02:30
Posts: 7
Hi,

When we scroll the scrollbar below the window boundary, the images that are assigned to the row no longer respect the rules when disabling ButtonEdit.


Attachments:
uTeste.rar [4.01 KiB]
Downloaded 55 times
Top
 Profile  
 
PostPosted: 16 Sep 2022, 13:15 
Offline

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

I can't open Form file.
AV in dsnap280.bpl.
Can you create data for DataSet in the code?


Attachments:
sshot-264.png
sshot-264.png [ 88.54 KiB | Viewed 811 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
PostPosted: 16 Sep 2022, 17:12 
Offline

Joined: 09 Aug 2016, 02:30
Posts: 7
EhLibSupport wrote:
Hello

I can't open Form file.
AV in dsnap280.bpl.
Can you create data for DataSet in the code?


Attachments:
uTeste.rar [4.02 KiB]
Downloaded 51 times
Top
 Profile  
 
PostPosted: 16 Sep 2022, 21:54 
Offline

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

Code:
procedure TForm1.grdGradeColumns5CellButtons0GetEnabledState(Grid: TCustomDBGridEh;
  Column: TColumnEh; CellButton: TDBGridCellButtonEh; var ButtonEnabled: Boolean);
begin
  ButtonEnabled := not Grid.DataSource.DataSet.IsEmpty and (Grid.DataLink.ActiveRecord = Grid.Row - 1);
  //ButtonEnabled := not Grid.DataSource.DataSet.IsEmpty and (Grid.DataSource.DataSet.RecNo = Grid.Row);
end;


You should use Grid.DataLink.ActiveRecord = Grid.Row - 1 expression to check the current record.
The number of rows in the DBGrid is equal to the number of visible rows.
So when scrolling, RecNo will increase but Grid.Row will not exceed the number of visible rows.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 16 Sep 2022, 23:48 
Offline

Joined: 09 Aug 2016, 02:30
Posts: 7
EhLibSupport wrote:
Hello

Code:
procedure TForm1.grdGradeColumns5CellButtons0GetEnabledState(Grid: TCustomDBGridEh;
  Column: TColumnEh; CellButton: TDBGridCellButtonEh; var ButtonEnabled: Boolean);
begin
  ButtonEnabled := not Grid.DataSource.DataSet.IsEmpty and (Grid.DataLink.ActiveRecord = Grid.Row - 1);
  //ButtonEnabled := not Grid.DataSource.DataSet.IsEmpty and (Grid.DataSource.DataSet.RecNo = Grid.Row);
end;


You should use Grid.DataLink.ActiveRecord = Grid.Row - 1 expression to check the current record.
The number of rows in the DBGrid is equal to the number of visible rows.
So when scrolling, RecNo will increase but Grid.Row will not exceed the number of visible rows.


Thanks so much! I understand.
:D


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 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:  
Powered by phpBB® Forum Software © phpBB Group