Description:-
The Microsoft Axapta Object Server supports
Microsoft’s COM (Common Object Model), DCOM (Distributed Common Object Model)
and ActiveX controls. This enables Microsoft Axapta to use the advanced
flexible COM technology either directly or indirectly using third party
applications.
In AX, each ActiveX control will be having a
classId. This entry willsexplain you how to use html document ActiveX
control in Axapta.
How to add ActiveX control to your form
- create form by Name MyActiveXExample
- MyActiveXExample > design > New control > ActiveX
- Select html document ActiveX control from the list of ActiveX’s displayed by Ax and name the newActiveX control as HtmlActiveX.
- Make the Autodeclaration property of the newly created ActiveX control to Yes
- After that , if you want to display html content in that ActiveX Control,
- Add the below code in the init() method of your MyActiveXExample form
public void init() { str htmlSource; COMDispFunction webpreviewWrite; COMVariant text = newCOMVariant(); COM ctrl = newCOM(); ; super(); htmlSource = @' <html><pre><hrcolor="#99CCFF"> <center> Search in Google <FORM method=GET action="http://www.google.com/search"> <TABLE bgcolor="#FFFFFF"><tr><td> <A HREF="http://www.google.com/"> <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" <br></A> <INPUT TYPE=text name=q size=31 maxlength=255 value=""> <INPUT TYPE=hidden name=hl value="en"> <INPUT type=submit name=btnG VALUE="Google Search"> </td></tr></TABLE> </FORM> </center></pre> <hrcolor="#99CCFF"></html>'; //ctrl.attach(HtmlActiveX.interface()); //webpreviewWrite = new COMDispFunction(ctrl, 'write', COMDispContext::METHOD); //text.bStr(htmlSource); //HtmlActiveX.open(""); //webpreviewWrite.call(text); //HtmlActiveX.close(); }
The above code will allow use to
browse through google without opening the web page ,because i added the html
controls and the functionalities to the controls to search in google.
I have mapped the htmlActiveX control to my Com
object and i am writing the html string to the comVariant. Open ActiveX control
by .open () method. Finally i am calling my comdispFunction object i.e.webpreviewWrite.call
(text) to open the content in the ActiveX. Then i closed my ActiveX control by using close () method. Then if you open the form You will see the
result as below
Thanks for comments.....