[Gambas-user] DataView Help
gradobag at gradobag.it
Sat Jul 8 18:26:30 CEST 2023
Il 08/07/23 17:53, T Lee Davidson ha scritto:
> 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
>> 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
>> 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.
thank you again for your prompt reply.
Before sending a report with your suggestions, I will try to see if
Benoit would like to respond.
I agree that you can't save something before you ... save it :-)
But I refer you to the FBrowser New button code of the gb.db.form
component and this says:
Public Sub btnNew_Click()
'DIM hSrc AS DataSource = Common.GetSource(ME)
'IF NOT hSrc THEN RETURN
'$iIndex = -1
dvwBrowser is actually a DataView and $hSrc is the DataSource btnNew is
like my btnAdd
With best regards
More information about the User