[Gambas-user] DataView Help

T Lee Davidson t.lee.davidson at gmail.com
Sat Jul 8 17:53:04 CEST 2023

On 7/8/23 09:39, Gianluigi wrote:
> Il 07/07/23 21:46, T Lee Davidson ha scritto:
>> First, I think DataView.Create and DataSource.Create should be separated into distinct event handlers as in the code below, 
>> because one is for creating a new record and the other is for saving the record.
> I thought I could use it with bUpdate to False and to save the records written in the DataControls use DataSource.Save, with the 
> BeforeSave preemptive filter.
> But even so it shows all the malfunctions already described, even by you (more precisely).

Okay. I can't see any reason why that strategy wouldn't work. But, the function of creating a new record for editing (Add) and 
the function of saving the edited record (Save) should be separated. Otherwise, the user would have no opportunity to edit the 
record before it is saved with DataSource.Create.

>> Second, I suspect the difficulty you are having is due to bugs in the Controls.
> I think you are referring to DataSource and DataView

Yes, I was referring to the data controls; primarily DataView but also DataControl.

> What do you suggest, do I write a bugtracker report and if so what should I say more (or less) than this?
> Benoit wants one bug at a time but in this case how to do it?

There appear to be four issues:

1. DataView.Create does not add a new record unless DataView.Editable=True. This may be intended behavior; I don't know.

2. When a newly created record is saved with DataSource.Create, DataView improperly displays the updated table data by 
duplicating the last record instead of showing the new (correctly saved) record.

3. DataView.Update appears to do nothing. (I added a 'refresh' ToolButton to the form to explicitly test this.)

4. The date chooser presented in a DataControl for a date-based field automatically saves the record when it is closed. It 
should not do so.


More information about the User mailing list