[Gambas-user] DataView Help

Gianluigi gradobag at gradobag.it
Sat Jul 8 15:39:52 CEST 2023

Il 07/07/23 21:46, T Lee Davidson ha scritto:
> On 7/7/23 11:26, Gianluigi wrote:
>> Hi Benoit,
>> in this (*) your response to Hans, to have more control over the 
>> data, you suggest the use of DataView and custom buttons.
>> (*) 
>> https://lists.gambas-basic.org/pipermail/user/2022-August/076746.html
>> For the past few days I have been trying to figure out how to insert 
>> new data (Minnie) into the project table that you can download at 
>> this link:
>> https://paste.c-net.org/TrippPaolo
>> (It weighs too much because of the presence of images).
>> Can you kindly put me on the right track?
>> I thank you for your attention and sorry for my ignorance
>> Regards
>> Gianluigi

Dear Lee,

> Well I'm not Benoît, obviously, but here are my observations from 
> playing around with it.

Better than Benoit :-P since you answered :-)
Maybe I shouldn't have written it since I'm hoping a response from him :-\

> 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).
> Second, I suspect the difficulty you are having is due to bugs in the 
> Controls.
I think you are referring to DataSource and DataView
> The only way I found to get the DataView to add a new blank record, is 
> to set it Editable prior to calling the Create method. The 
> DataControls are then blanked out, but the DataView still does not 
> display the new blank record.
The final behavior is always the same as you rightly write immediately 
> The saving of only a partial record appears to be caused by the 
> behavior of the date chooser in the DataControl for the 'birth_date' 
> field. When that dialog is closed (either by pressing ESC or by 
> clicking on the field), the record is automatically saved. Fields that 
> have not yet been populated with data are set to null values in the 
> database.
> The last record in the DataView is indeed duplicated in the display, 
> but not in the database. The newly created record is actually inserted 
> into the database but not displayed.
> DataView.Update appears to do nothing.
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?
> [code] ...



More information about the User mailing list