CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Enabled doesn't work if Edit is connected to the DataSource

by asp » 09 Nov 2016 15:07

Hi!
If Edit is connected to the datasource, Enabled doesn't work properly. You can't make the control disabled. Even if you set Enabled = false, the component will be active. Datalink.StateChangeOperation is set to scoNone. The same problem seems to affect all the controls with DataLink property. See attached project.
You do not have the required permissions to view the files attached to this post.
asp
 
Posts: 235
Joined: 06 Dec 2013 11:17
Location: Moscow, Russia

by Alexander Bulei » 11 Nov 2016 12:48

Hi asp,

Fixed. It was only appearance issue.
Thanks ;)

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3637
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by asp » 21 Nov 2016 12:13

Hi, Alexander!

I tried the version 3.0.0.87 and it doesn't repair the bug. Check out the test project I posted before.

I guess the problem with the following code in procedure TIWCGJQCustomEdit.DataLinkActiveChange

Code: Select all
if Assigned(DataLink.DataSource) and Assigned(DataLink.DataSource.DataSet) then
  begin
    if not IsDesignMode then
      Enabled:= DataLink.DataSource.DataSet.Active;

    case DataLink.StateChangeOperation of
      scoEnable: Enabled:= DataLink.DataSource.DataSet.Active and DataLink.Editing;
      scoReadOnly: ReadOnly:= not (DataLink.DataSource.DataSet.Active and DataLink.Editing);
    end;
...
end;


You don't take into account the fact that the control could be disabled 'by design'. So, the code should be something like this

Code: Select all
if Assigned(DataLink.DataSource) and Assigned(DataLink.DataSource.DataSet) then
  begin
    if Enabled then begin
    if not IsDesignMode then
      Enabled:= DataLink.DataSource.DataSet.Active;

    case DataLink.StateChangeOperation of
      scoEnable: Enabled:= DataLink.DataSource.DataSet.Active and DataLink.Editing;
      scoReadOnly: ReadOnly:= not (DataLink.DataSource.DataSet.Active and DataLink.Editing);
    end;
 end;
...
end;
asp
 
Posts: 235
Joined: 06 Dec 2013 11:17
Location: Moscow, Russia

by Alexander Bulei » 23 Nov 2016 12:07

Hi asp,

When control is attached to DB (via DataLink), as you can see, begins to be controlled by DataSet.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3637
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by asp » 24 Nov 2016 13:36

Hi, Alexander!

Alexander Bulei wrote:Hi asp,

When control is attached to DB (via DataLink), as you can see, begins to be controlled by DataSet.

Best Regards.


Yes, I understand that. And I think it is not correct. For example, I want to have an edit control attached to the dataset, but disabled to show the user that he can not change the value.
asp
 
Posts: 235
Joined: 06 Dec 2013 11:17
Location: Moscow, Russia


Return to JQEdit

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.