[Gambas-user] DataView Help

Benoit Minisini benoit.minisini at gambas-basic.org
Tue Jul 11 13:53:23 CEST 2023


Le 11/07/2023 à 11:45, Gianluigi a écrit :
>>
>> The mess comes from your Form_Activate() event handler that is raised 
>> each time the form is activated.
>>
>> It moves the DataSource cursor, and so always save the current record 
>> when, for example, the calendar popup closes
>>
>> What should do the code in Form_Activate(), and why?
>>
> Hi Benoit,
> 
> As usual, in fact it seemed impossible for me to be right, I am an idiot.
> The code (hoping it's correct) is only for opening so I can select the 
> first line.
> I moved it to Form_Open and it seems to work fine.
> 
> I apologize for the late reply, I wanted to complete the project you 
> find here ( https://paste.c-net.org/ConfirmMarches ), unfortunately two 
> issues remain:
> 
> 1- Most important, I can't figure out how to get the saved record row so 
> that I can select it after saving.

Mmm... Indeed it's not easy to achieve that.

Otherwise, you can use the DataView.Find() method to move the view to a 
specific record from a SQL where clause. It's easy if you know the 
primary keys of the record you just have created.

> 
> 2- I have not figured out how to do why Stop Event in BeforeSave does 
> not also delete the data already entered.

Stop Event in BeforeSave just stops the save process. It won't change 
the data already entered.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list