Dear all,
While Am searching for "Refreshing Form From Subform" i came through a particular discussion , it states that there is no standard navision functions for refreshing form from subform and we need to write a seperate code using XMLDOC . Here is where the specific code given by Mr.Garak
OBJECT Form 50000 Parent
{
OBJECT-PROPERTIES
{
Date=07-08-30;
Time=15:14:11;
Modified=Yes;
Version List=;
}
PROPERTIES
{
Width=8000;
Height=4840;
OnOpenForm=BEGIN
CREATE(XmlDoc);
CurrForm.SubForm.FORM.SetXmlDoc(XmlDoc);
END;
OnCloseForm=BEGIN
CLEAR(XmlDoc);
END;
}
CONTROLS
{
{ 1000000000;TextBox;330 ;220 ;4290 ;440 ;Editable=No;
SourceExpr=TextVar }
{ 1000000001;SubForm;220 ;880 ;7480 ;2310 ;Name=SubForm;
SubFormID=Form50001 }
}
CODE
{
VAR
TextVar@1000000000 : Text[50];
XmlDoc@1000000001 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 4.0:{88D969C0-F192-11D4-A65F-0040963251E5}:'Microsoft XML, v4.0'.DOMDocument40" WITHEVENTS;
EVENT XmlDoc@1000000001::ondataavailable@198();
BEGIN
END;
EVENT XmlDoc@1000000001::onreadystatechange@-609();
BEGIN
IF (XmlDoc.readyState = 4) THEN BEGIN
TextVar := CurrForm.SubForm.FORM.GetText();
CurrForm.UPDATE(FALSE);
END;
END;
BEGIN
END.
}
}
OBJECT Form 50001 Child
{
OBJECT-PROPERTIES
{
Date=07-08-30;
Time=15:19:54;
Modified=Yes;
Version List=;
}
PROPERTIES
{
Width=8030;
Height=2420;
}
CONTROLS
{
{ 1000000000;TextBox;220 ;220 ;4180 ;440 ;SourceExpr=TextVar1;
OnAfterValidate=BEGIN
SendMessage();
END;
}
{ 1000000001;TextBox;220 ;770 ;4180 ;440 ;SourceExpr=TextVar2 }
}
CODE
{
VAR
TextVar1@1000000000 : Text[50];
TextVar2@1000000002 : Text[50];
XmlDoc@1000000001 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 4.0:{88D969C0-F192-11D4-A65F-0040963251E5}:'Microsoft XML, v4.0'.DOMDocument40";
PROCEDURE SetXmlDoc@1000000000(pXmlDoc@1000000000 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 4.0:{88D969C0-F192-11D4-A65F-0040963251E5}:'Microsoft XML, v4.0'.DOMDocument40");
BEGIN
XmlDoc := pXmlDoc;
END;
PROCEDURE SendMessage@1000000004();
BEGIN
XmlDoc.loadXML('<root></root>');
END;
PROCEDURE GetText@1000000001() : Text[50];
BEGIN
EXIT(TextVar1);
END;
BEGIN
END.
}
}
What is the neeed for writing code using Automation "'Microsoft XML, v4.0'.DOMDocument40". Can Any one explain me????
0
Comments
Did you read the post where you added the same question?
With native commands it is not possible to update the main form from a subform.
The great solution provided by Garak, is an easy solution to this problem.
Regards,
Willy
My Blog - nav.education