Hi All
When trying to add a button (reportsButton) with solution model code (see below) to a dynamically loaded form (i. e. with .addTab()), the button (or therefor any other element like field, label, …) is NOT showing up on the loaded form.
The wierd thing is, if I do make a change on the loaded form in the form designer and save the change, the reportsButton appears on the the form. This “trick” works only once, i. e. the first time making a change on the form and saving it.
// Load detail form PerMasterData
elements.tabDetail.addTab(forms.PerMasterData, null, null, null, null, null, null);
// Add the reports button to the corresponding form of the selected menu
history.removeForm(elements.tabDetail.getTabFormNameAt(1));
var detailForm = solutionModel.getForm(elements.tabDetail.getTabFormNameAt(1));
var onActionMethod = solutionModel.getGlobalMethod('onActionReportsFor2');
var reportsButton = detailForm.newButton(null, 0, 682, 40, 18, onActionMethod);
reportsButton.styleClass = 'Default';
reportsButton.borderType = 'EmptyBorder, 0, 0, 0, 0';
reportsButton.imageMedia = solutionModel.getMedia('btnReportGradient.png');
reportsButton.mediaOptions = SM_MEDIAOPTION.CROP;
reportsButton.anchors = SM_ANCHOR.WEST | SM_ANCHOR.SOUTH;
reportsButton.showClick = true;
reportsButton.showFocus = true;
application.updateUI();
Has anyone successfully added a (solution model) element to a loaded form? I also should mention, that the assigned method to the reportsButton does not execute ever (not even the single time the button appears on the form). What am I missing?
Best regards, Robert