Page 1 of 1

event order was different

PostPosted: 19 Sep 2014 03:56
by mjq
Hello,

My App has Grid and Navigator, and editing area using Edit.

Because I wanted to cancel editing/inserting data
if current row changed before posting,
I assinged SelectRow event handler for the grid like this:

delphi code
procedure TMyFrame.IWCGJQGrid1JQGridOptionsSelectRow(Sender: TObject;
AParams: TStringList);
begin
if Query1.State <> dsBrowse then Query1.Cancel;
IWCGJQGrid1.LocateSelectedRowId;
end;


When editing, this works well (in fact there are some problems but I don't mention now),
but when the row of the grid was changed by grid's paging button after inserting and before posting,
error message dialog was showed, so it seemed that Query1.Cancel was not executed.

I investigated, and found that the order of occurring event was different in some situation.
When the Query inserting,
if the grid's row was changed by clicking another row, SelectRow event occurs before Post event of Query,
but if changed by paging button, the occurrence order was reverse.

BTW, the paging button which I said is this:
pagingbutton.gif


I wonder why these are different.
Anyway, aren't there any other good means to resolve?

Re: event order was different

PostPosted: 19 Sep 2014 10:26
by Jorge Sousa
Hello

You have to submit us a test case, because we don't know what you're doing.

If you want you can use the attached demo, because of the data.

Re: event order was different

PostPosted: 22 Sep 2014 07:47
by mjq
Hi,

Now I submitted test case.

It's difficult for me to use attached demo and apply my problems,
so I simplified and provided my app which contains some problems which I want to resolve.

I hope that this becomes the key to some kind of solution...

P.S.
In order to function the foreign key constraint, you might need to use latest version of SQLite.
And to enable paging button, you might need to resize browser that you execute this test case.

Re: event order was different

PostPosted: 22 Sep 2014 07:50
by mjq
Hi again,

The explanation is:

*couldn't cancel inserting data programatically when grid's paging button was clicked before posting.
To confirm, please click grid's paging button after clicking insert button of navigator.
(Please try several times because this phenomenon sometimes occurs and sometimes does not occur.
It's more likely to occur when you click the "first" button or the "last" button.)