[Gambas-user] Gambas Datasource Control

Benoît Minisini gambas at ...1...
Fri Mar 28 16:41:07 CET 2014

Le 28/03/2014 14:55, Nigel Verity a écrit :
> Hi
> I have used Gambas very successfully in conjunction with a Sqlite
> database, but I have written my own procedures to exchange data
> between the  controls and the database. This provides great
> flexibility but does require quite a lot of code.
> I am now experimenting with the use of the data-bound controls. I
> need to perform some validation before a record is saved, and require
> the option to abort the save entirely. The documentation describes a
> "BeforeSave" event for the datasource control which is just what I
> need. However, I can find no way of trapping this event as the IDE
> does not appear to provide the option of generating the event
> handler. I have tried inserting the appropriate code manually but it
> has no effect.
> Grateful for any advice.
> Thanks
> Nige

At the moment the BeforeSave() event handler cannot stop the save 
process. I can add that in the next version (i.e. if you call STOP EVENT 
during BeforeSave(), no save is performed) but not for the current version.

What sort of validation do you need? Maybe there is a workaround: for 
example, the DataControl has a "Validate" event that allows to 
individually validate the data entered by the user.

Benoît Minisini

More information about the User mailing list