Hi,
Is the following a bug or is it intended to work like this:
With the SolutionModel I create a new form.
This new forms shoud inherit the properties of another form.
This works without problems:
var _js_dtl_form = solutionModel.getForm('myForm1')
if (! _js_dtl_form) // No form found. Quit the function
return;
var _js_sea_form = solutionModel.newForm('myForm2', _js_dtl_form.serverName, _js_dtl_form.tableName, _js_dtl_form.styleName, false, _js_dtl_form.getBodyPart().height, _js_dtl_form.width)
_js_sea_form.extendsForm = _js_dtl_form
_js_sea_form.useSeparateFoundSet = true
The form is shown correctly when I show myForm2.
But it looks like that the methods are not inherited. I have an globals method on the onShow event on my first form, but I see that this onShow event is not called on my second form.
When I add the following line, it does work:
if (_js_dtl_form.onShow)
_js_sea_form.onShow = _js_dtl_form.onShow;
Is this correct or is this an issue?
Martin
that should work fine, i cant reproduce it in quick example:
/**
* Callback method when form is (re)loaded.
*
* @param {JSEvent} event the event that triggered the action
*
* @properties={typeid:24,uuid:"CFC9F108-DAF1-47FD-8F27-220700A418F0"}
*/
function onLoad(event) {
application.output("onload:" + controller.getName());
}
/**
* Callback method for when form is shown.
*
* @param {Boolean} firstShow form is shown first time after load
* @param {JSEvent} event the event that triggered the action
*
* @properties={typeid:24,uuid:"D2682977-675B-4049-8EDE-2CFB00DACE5F"}
*/
function onShow(firstShow, event) {
application.output("onshow:" + controller.getName());
}
/**
* @properties={typeid:24,uuid:"DE7E8D42-EF4C-4F3C-A58E-ADFF9DCCDC54"}
*/
function subform()
{
var form = solutionModel.getForm("Test");
var newForm = solutionModel.newForm("Test2",form.dataSource,null,false,600,400);
newForm.extendsForm = form;
forms.Test2.controller.show();
}
those i add to a form “Test” which creates a new form and attach itself to that new form
then when i show it will display it, this is the complete output:
onload:Test
onshow:Test
onload:Test2
onshow:Test2
Johan,
There are some differences with your test
- I’m using 4.1.6
- I’m using global methods
I did the same as you, but I didn’t get the output
But after quiting the developer and restarting developer again, it seem to work.
So it looks like there is some issue in developer that keeps somewhere in memory settings from a previous run
If I have more details I’ll let you know.
Martin
global method shouldn’t really be any different then form specific onces.
Maybe there is a bug in 4.1.6, or some other kind of caching that isnt updated.
yes it looks like that. I’ll try to find it out
Maybe it is not a bug, but I’m wondering if all goes well.
It looks like the onShow event is not triggered.
The situation is that the form is shown and then set into find mode in the same script.
And then the onShow event is not triggered.
Is that correct behavior?
Because now I have to execute the onShow method on each place where I expect an onShow event can happen.
onshow should be called if that a form is made visible
So if you have a sequence of events that you see that onshow isnt triggered let me know.