When is the CreateRow event raised?

Posted by Froy on 09-Jun-2010 02:28

hello,

I have got a little problem for some days, i don't really understand when the CreatedRow (event of the binding source) is raised.

Here is the sample :

CREATE ttCamion.
        hTopQuery = hds:TOP-NAV-QUERY(1).
        hTopQuery:QUERY-OPEN.

The row in the BS is well added but the event CreateRow is not raised. does someone know what the problem is?

Thanks

All Replies

Posted by marko.rueterbories on 09-Jun-2010 05:04

Hey Patrick,

the CreateRow event of the BindingSource is raised if you programmatically add a row using the BindingSource:AddNew () method or if you are using the UltraControls enabling the UltraGrid to create rows.

If you do create a row inside of the TEMP-TABLE the BindingSource has to be repositioned to the new row by code query:REPOSITION-TO-ROWID ().

Regards,

Marko

Posted by Admin on 09-Jun-2010 05:19

If you do create a row inside of the TEMP-TABLE the BindingSource has to be repositioned to the new row by code query:REPOSITION-TO-ROWID ().

 

Just to make that a bit clearer. When the UI initiates the creation of a new row (like described in Marko's) the CreateRow event is raised. There you should do something like:

CREATE ttCamion.

hTopQuery:CREATE-RESULT-LIST-ENTRY() .

e:Created = TRUE.

In this case there is no need to reposition the query.

a) the record is still available and

b) the query is not yet aware of the new record (therefor the CREATE-RESULT-LIST-ENTRY).

Be aware, that the Buffer ttCamion needs to be the same buffer that is navigated by the query.

Posted by Froy on 09-Jun-2010 08:27

And how can the query get awared of the new row added after a create ttCamion?

Posted by Admin on 09-Jun-2010 08:29

And how can the query get awared of the new row added after a create ttCamion?

hTopQuery:CREATE-RESULT-LIST-ENTRY() .

Posted by Froy on 09-Jun-2010 09:22

Thank you.That works. Actually,I had another problem but thank you for your help

This thread is closed