New record in dialog only when method ran twice

This method is attached to a button from a banner form in a tabless tabpanel. When run for the first time in a new session it pops the dialog but fails to activate the new record command. after escaping the dialog and rerunning the method the new record function runs and a blank form is available for input. namedfoundset is set to DEFAULT ( have tried Separate). The global current_ProjectID is also recorded incorrectly on the form first time but correctly on the second execution.

Any ideas why this would be happening?

application.showFormInDialog( forms.project_dlg_scope,  -1, -1,  508,  315,  'Scope',  false,  false,  'Scope', true);
databaseManager.setAutoSave(false);
forms.project_dlg_scope.controller.newRecord();  
forms.project_dlg_scope.project_id = globals.current_ProjectID

Hi James,

Servoy stops executing the code after ‘showFormInDialog’

So:

  1. create your record with everything that has to be in there (starting with an empty foundset would be most easy I guess)
  2. show the form in dialog & load the foundset defined in 1

Hope this helps

Strange, I have never come across this before and I pop a dialog for most of my editing. Pure luck in the past I guess.

Worked fine, Thanks

James