Hi Benoit I have tested the .validate() event of the datacontrol. It meets my requirement to test and modify the data entered in the control but is there any way to abandon the save entirely if certain criteria are not met?
Thanks Nige Date: Fri, 28 Mar 2014 16:41:07 +0100 From: Beno?t Minisini <gam...@users.sourceforge.net> Subject: Re: [Gambas-user] Gambas Datasource Control To: mailing list for gambas users <gambas-user@lists.sourceforge.net> Message-ID: <53359813.60...@users.sourceforge.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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 ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user